diff --git a/types/react-native-dialog/index.d.ts b/types/react-native-dialog/index.d.ts new file mode 100644 index 0000000000..3a1cf94be9 --- /dev/null +++ b/types/react-native-dialog/index.d.ts @@ -0,0 +1,72 @@ +// Type definitions for react-native-dialog 4.0 +// Project: https://github.com/mmazzarolo/react-native-dialog +// Definitions by: MrLuje +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import { Ref, PureComponent, ReactNode } from "react"; +import { + ViewProps, + TextProps, + StyleProp, + TextInputProps, + ViewStyle +} from "react-native"; + +interface ButtonProps { + label: string; + /** + * default: + * ios #007ff9 + * android #169689 + */ + color?: string; + bold?: boolean; + /** + * default: false + */ + + disabled?: boolean; + onPress: () => void; +} + +interface ContainerProps { + blurComponentIOS?: ReactNode; + children: JSX.Element[]; + /** + * default: false + */ + visible?: boolean; +} + +interface TitleProps { + children: string; +} + +interface InputProps { + label?: string; + textInputRef?: Ref; + wrapperStyle?: StyleProp; +} + +interface DescriptionProps { + children: string; +} + +export namespace Dialog { + class Button extends PureComponent< + ButtonProps & ViewProps & TextProps + > {} + class Container extends PureComponent {} + class Title extends PureComponent< + TitleProps & ViewProps & TextProps + > {} + class Input extends PureComponent< + InputProps & ViewProps & TextInputProps + > {} + class Description extends PureComponent< + DescriptionProps & ViewProps & TextProps + > {} +} + +export default Dialog; diff --git a/types/react-native-dialog/react-native-dialog-tests.tsx b/types/react-native-dialog/react-native-dialog-tests.tsx new file mode 100644 index 0000000000..151ee14af5 --- /dev/null +++ b/types/react-native-dialog/react-native-dialog-tests.tsx @@ -0,0 +1,29 @@ +import Dialog from "react-native-dialog"; +import { createRef, Component } from "react"; + +class Example extends Component { + render() { + const ref = createRef(); + + return ( + + + A nice title + + A good descr + + console.log("test")} + /> + console.log("test")} + /> + + ); + } +} diff --git a/types/react-native-dialog/tsconfig.json b/types/react-native-dialog/tsconfig.json new file mode 100644 index 0000000000..5049e638d3 --- /dev/null +++ b/types/react-native-dialog/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-native" + }, + "files": [ + "index.d.ts", + "react-native-dialog-tests.tsx" + ] +} diff --git a/types/react-native-dialog/tslint.json b/types/react-native-dialog/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-dialog/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }