From 5388c360cedcbe0dd3d4af2e4683a07753f125b6 Mon Sep 17 00:00:00 2001 From: Gregory Galushka Date: Mon, 1 Feb 2021 18:26:29 +0200 Subject: [PATCH] Update authenticate.android.js Crash in case of calling authenticate function on android < 23 as authenticate method in Java does not have such interface. Also fix for such crashes: https://github.com/hieuvp/react-native-fingerprint-scanner/issues/153 https://github.com/hieuvp/react-native-fingerprint-scanner/issues/158 --- src/authenticate.android.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/authenticate.android.js b/src/authenticate.android.js index f01ae835..8da0ae53 100644 --- a/src/authenticate.android.js +++ b/src/authenticate.android.js @@ -18,14 +18,14 @@ const authCurrent = (title, subTitle, description, cancelButton, resolve, reject }); } -const authLegacy = (onAttempt, resolve, reject) => { +const authLegacy = (title, subTitle, description, cancelButton, onAttempt, resolve, reject) => { DeviceEventEmitter.addListener('FINGERPRINT_SCANNER_AUTHENTICATION', (name) => { if (name === 'AuthenticationNotMatch' && typeof onAttempt === 'function') { onAttempt(createError(name)); } }); - ReactNativeFingerprintScanner.authenticate() + ReactNativeFingerprintScanner.authenticate(title, subTitle, description, cancelButton) .then(() => { DeviceEventEmitter.removeAllListeners('FINGERPRINT_SCANNER_AUTHENTICATION'); resolve(true); @@ -58,7 +58,7 @@ export default ({ title, subTitle, description, cancelButton, onAttempt }) => { } if (Platform.Version < 23) { - return authLegacy(onAttempt, resolve, reject); + return authLegacy(title, subTitle, description, cancelButton, onAttempt, resolve, reject); } return authCurrent(title, subTitle, description, cancelButton, resolve, reject);