mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-12 19:59:02 +08:00
Merge pull request #24407 from RodrigoAWeber/master
Add typings for react-native-text-input-mask
This commit is contained in:
20
types/react-native-text-input-mask/index.d.ts
vendored
Normal file
20
types/react-native-text-input-mask/index.d.ts
vendored
Normal 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> { }
|
||||
@@ -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]"}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
25
types/react-native-text-input-mask/tsconfig.json
Normal file
25
types/react-native-text-input-mask/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/react-native-text-input-mask/tslint.json
Normal file
1
types/react-native-text-input-mask/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user