add react-native-touch-id

This commit is contained in:
huhuanming
2017-06-30 01:23:43 +08:00
parent 5f83c2747d
commit 19b33b90d7
3 changed files with 45 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for react-native-touch-id 3.0.0
// Project: https://github.com/naoufal/react-native-touch-id
// Definitions by: huhuanming <https://github.com/huhuanming>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'react-native-touch-id' {
class TouchIDError {
name: 'LAErrorAuthenticationFailed' | 'LAErrorUserCancel' | 'LAErrorUserFallback' | 'LAErrorSystemCancel'
| 'LAErrorPasscodeNotSet' | 'LAErrorTouchIDNotAvailable' | 'LAErrorTouchIDNotEnrolled'
| 'LAErrorTouchIDNotEnrolled' | 'RCTTouchIDUnknownError' | 'RCTTouchIDNotSupported';
message: string;
details: any;
}
export const isSupported: () => Promise<boolean | string>;
export const authenticate: (reason: string) => Promise<boolean | TouchIDError>;
}
@@ -0,0 +1,5 @@
import { isSupported, authenticate } from 'react-native-touch-id';
isSupported().then(() => {}).catch(() => {});
authenticate('reason').then(() => {}).catch(() => {});
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-native-touch-id-tests.ts"
]
}