Merge pull request #23977 from gazaret/react-native-touch-id-4

[react-native-touch-id] Update to 4.0.0
This commit is contained in:
Armando Aguirre
2018-03-06 12:36:25 -08:00
committed by GitHub
2 changed files with 14 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
// Type definitions for react-native-touch-id 3.0.0
// Type definitions for react-native-touch-id 4.0.0
// Project: https://github.com/naoufal/react-native-touch-id
// Definitions by: huhuanming <https://github.com/huhuanming>
// Nikolay Polukhin <https://github.com/gazaret>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'react-native-touch-id' {
@@ -13,6 +14,11 @@ declare module 'react-native-touch-id' {
details: any;
}
export const isSupported: () => Promise<boolean | TouchIDError>;
export const authenticate: (reason: string) => Promise<boolean | TouchIDError>;
export interface AuthenticateConfig {
title: string;
color: string;
}
export const isSupported: () => Promise<boolean | string | TouchIDError>;
export const authenticate: (reason: string, config?: AuthenticateConfig) => Promise<boolean | TouchIDError>;
}

View File

@@ -3,3 +3,8 @@ import { isSupported, authenticate, TouchIDError } from 'react-native-touch-id';
isSupported().then((isOk: boolean) => {}).catch((error: TouchIDError) => {});
authenticate('reason').then((isOk: boolean) => {}).catch((error: TouchIDError) => {});
authenticate('reason', {
title: 'Authentication Required',
color: '#1306ff'
}).then((isOk: boolean) => {}).catch((error: TouchIDError) => {});