繁体   English   中英

React Native Fingerprint Scanner 花费太多时间进行身份验证

[英]React Native Fingerprint Scanner taking too much time to authenticate

我正在使用 "react-native-fingerprint-scanner": "^6.0.0" 它在模拟器上运行良好。 但是当我构建 apk 时,在真实设备上进行身份验证需要花费太多时间(3 或 4 秒)。 我能做些什么?

这是我的代码:

常量 SplashBeforeFingerprint = ({ 导航 }) => {

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>
) }

我无法评论。 我有类似的问题。 行为:第一次运行屏幕 - 大约 10 秒后,没有任何反应,它显示了对身份验证的对话框。 如果身份验证正常或取消,稍后它会立即打开。

我安装了这些包:react-native-pincode、@react-native-async-storage/async-storage 和 react-native-keychain。

因此,解决方案是卸载它们。 从这篇文章中得到答案: 如何从 react-native 项目中取消链接库

  • 取消链接
  • 卸载
  • 在 setting.gradle 和 MainActivity.java 中评论导入(如果没有完成,您将无法编译您的项目)
  • gradlew 清理并重新编译例如 npx react-native run-android

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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