mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Add types for react-native-platform-touchable
This commit is contained in:
32
types/react-native-platform-touchable/index.d.ts
vendored
Normal file
32
types/react-native-platform-touchable/index.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Type definitions for react-native-platform-touchable 1.1
|
||||
// Project: https://github.com/react-native-community/react-native-platform-touchable
|
||||
// Definitions by: Toni Granados <https://github.com/tngranados>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from "react";
|
||||
import { BackgroundPropType, RippleBackgroundPropType, ThemeAttributeBackgroundPropType, TouchableWithoutFeedbackProps } from "react-native";
|
||||
|
||||
export interface PlatformTouchableProps extends TouchableWithoutFeedbackProps {
|
||||
// TouchableOpacity (default iOS)
|
||||
activeOpacity?: number;
|
||||
// TouchableNativeFeedback (default Android)
|
||||
background?: BackgroundPropType;
|
||||
foreground?: boolean;
|
||||
// TouchableHighlight
|
||||
underlayColor?: string;
|
||||
onHideUnderlay?: () => void;
|
||||
onShowUnderlay?: () => void;
|
||||
}
|
||||
|
||||
export class Touchable extends React.Component<PlatformTouchableProps> {
|
||||
// TouchableOpacity (default iOS)
|
||||
setOpacityTo: (value: number) => void;
|
||||
// TouchableNativeFeedback (default Android)
|
||||
static SelectableBackground(): ThemeAttributeBackgroundPropType;
|
||||
static SelectableBackgroundBorderless(): ThemeAttributeBackgroundPropType;
|
||||
static Ripple(color: string, borderless?: boolean): RippleBackgroundPropType;
|
||||
static canUseNativeForeground(): boolean;
|
||||
}
|
||||
|
||||
export default Touchable;
|
||||
@@ -0,0 +1,19 @@
|
||||
import * as React from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import Touchable from "react-native-platform-touchable";
|
||||
|
||||
class PlatformTouchableExample extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
|
||||
<Touchable
|
||||
onPress={() => {}}
|
||||
style={{ backgroundColor: "#eee", padding: 30 }}
|
||||
background={Touchable.Ripple("pink", false)}
|
||||
>
|
||||
<Text>Hello there!</Text>
|
||||
</Touchable>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
17
types/react-native-platform-touchable/tsconfig.json
Normal file
17
types/react-native-platform-touchable/tsconfig.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"jsx": "react-native",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "react-native-platform-touchable-tests.tsx"]
|
||||
}
|
||||
1
types/react-native-platform-touchable/tslint.json
Normal file
1
types/react-native-platform-touchable/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user