簡體   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