我已经在React Native
使用中实现了指纹认证的代码,react-native-fingerprint-scanner
并且可以正常工作。我的担忧听起来可能很愚蠢,但是当身份验证成功时,我实际上仍然停留在此上,我不知道如何进行检查,以便可以在setState
那里触发。这段代码只是返回一个字符串:
FingerprintScanner
.authenticate((description, onAttempt) => {
if (description) {
this.setState({ Authenticated: true })
}
//description: 'Log in with Biometrics'
})
.then(() => {
this.props.onAuthenticate();
})
注意:执行永远不会到达.then()
回调,否则我只会在那儿设置状态。不知道为什么要这么做!
在调用Authenticate之前或之后,我需要调用此方法来释放缓存:
FingerprintScanner.release();
这样,用户可以随时取消并重试。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句