[react-native-actionsheet]: add type definitions (#35459)

This commit is contained in:
Ian Rudge 2019-05-15 09:08:14 -07:00 committed by Nathan Shively-Sanders
parent 14a6f1dddd
commit 2e1661853a
4 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// Type definitions for react-native-actionsheet 2.4
// Project: https://github.com/beefe/react-native-actionsheet
// Definitions by: Ian <https://github.com/ian-rudge>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
export interface ActionSheetProps {
options: React.ReactNode[];
onPress: (index: number) => void;
title?: string;
message?: string;
tintColor?: string;
cancelButtonIndex?: number;
destructiveButtonIndex?: number;
styles?: object;
}
export default class ActionSheet extends React.Component<ActionSheetProps> {
show: () => void;
}

View File

@ -0,0 +1,19 @@
import * as React from 'react';
import ActionSheet from 'react-native-actionsheet';
class Example extends React.Component {
render() {
return (
<ActionSheet
options={['1', '2', '3']}
onPress={index => {}}
title="Test"
message="Test"
tintColor="white"
cancelButtonIndex={0}
destructiveButtonIndex={1}
styles={{}}
/>
);
}
}

View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"react-native-actionsheet-tests.tsx"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }