Merge pull request #24407 from RodrigoAWeber/master

Add typings for react-native-text-input-mask
This commit is contained in:
Mine Starks
2018-03-22 11:38:38 -07:00
committed by GitHub
4 changed files with 62 additions and 0 deletions

View File

@@ -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 <https://github.com/RodrigoAWeber>
// 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<TextInputMaskProps> { }

View File

@@ -0,0 +1,16 @@
import * as React from 'react';
import TextInputMask from 'react-native-text-input-mask';
class Example extends React.Component {
render() {
return (
<TextInputMask
onChangeText={(formatted, extracted) => {
console.log(formatted); // +1 (123) 456-78-90
console.log(extracted); // 1234567890
}}
mask={"+1 ([000]) [000] [00] [00]"}
/>
);
}
}

View File

@@ -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"
]
}

View File

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