diff --git a/types/react-native-text-input-mask/index.d.ts b/types/react-native-text-input-mask/index.d.ts new file mode 100644 index 0000000000..e95e68d7f7 --- /dev/null +++ b/types/react-native-text-input-mask/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for react-native-text-input-mask 0.7 +// Project: https://github.com/react-native-community/react-native-text-input-mask +// Definitions by: Rodrigo Weber +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; +import * as ReactNative from "react-native"; + +export type onChangeTextCallback = (formatted: string, extracted: string) => void; + +export interface TextInputMaskProps { + maskDefaultValue?: boolean; + mask: string; + value?: string; + onChangeText: onChangeTextCallback; + keyboardType?: 'default' | 'numeric' | 'email-address' | 'phone-pad'; +} + +export default class TextInputMask extends React.Component { } diff --git a/types/react-native-text-input-mask/react-native-text-input-mask-tests.tsx b/types/react-native-text-input-mask/react-native-text-input-mask-tests.tsx new file mode 100644 index 0000000000..918a994e35 --- /dev/null +++ b/types/react-native-text-input-mask/react-native-text-input-mask-tests.tsx @@ -0,0 +1,16 @@ +import * as React from 'react'; +import TextInputMask from 'react-native-text-input-mask'; + +class Example extends React.Component { + render() { + return ( + { + console.log(formatted); // +1 (123) 456-78-90 + console.log(extracted); // 1234567890 + }} + mask={"+1 ([000]) [000] [00] [00]"} + /> + ); + } +} diff --git a/types/react-native-text-input-mask/tsconfig.json b/types/react-native-text-input-mask/tsconfig.json new file mode 100644 index 0000000000..c9b3f10fc3 --- /dev/null +++ b/types/react-native-text-input-mask/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-text-input-mask-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-native-text-input-mask/tslint.json b/types/react-native-text-input-mask/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-text-input-mask/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }