简体   繁体   中英

React Native Fingerprint Scanner taking too much time to authenticate

I'm using "react-native-fingerprint-scanner": "^6.0.0" it works fine on emulator. But when I built apk it taking too much time(3 or 4 second) to authenticate on a real device. What can i do?

Here is my code:

const SplashBeforeFingerprint = ({ navigation }) => {

useEffect(() => {
        FingerprintScanner
            .authenticate({ description: 'Scan your fingerprint on the device scanner to continue' })
            .then(() => {
                    /// nothing to do
            })
            .catch((error) => {
                Alert.alert(
                    "Authentication failed",
                    "Your fingerprint doesn't matches! Try agin later!",
                    [
                        {
                            text: "Exit",
                            onPress: () => BackHandler.exitApp(),
                            style: "cancel"
                        },

                    ],
                    { cancelable: false });
            });

}, []);

return (
    <ImageBackground source={require("../img/Splash2.png")} style={styles.imageContainer} >
        <View style={styles.buttonContainer} >
            <AppButton style={styles.button} textStyle={styles.text} name={"Go to Home"} onPress={() => navigation.reset({
                index: 2,
                routes: [{ name: 'NewWallet' }],
            })} />

        </View>
    </ImageBackground>
) }

I cannot comment. I had similar problem. Behavior: first run of the screen - nothing happens, after around 10 seconds, it showed dialog to auth. If auth was ok or canceled, later it opened imidiately.

I installed these packages: react-native-pincode, @react-native-async-storage/async-storage and react-native-keychain.

So, solution was to uninstall them. Folow answer from this post: How to unlink library from react-native project

  • unlink
  • uninstall
  • comment imports in setting.gradle and MainActivity.java (if not done, you will not be able to compile your project)
  • gradlew clean and recompile eg npx react-native run-android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM