错误:验证器._Reset不是函数。尝试使用FireBase手机登录时,请响应本地和世博会 [英] Error: verifier._reset is not a function. when trying to Sign in with phone using firebase, react native and Expo
本文介绍了错误:验证器._Reset不是函数。尝试使用FireBase手机登录时,请响应本地和世博会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正尝试在mureat本机应用程序中实现手机登录,但收到以下错误:
verifier._reset is not a function. (In 'verifier._reset()', 'verifier._reset' is undefined)
at http://192.168.1.2:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:126633:27 in <unknown>
at node_modules/tslib/tslib.js:60:8 in createExporter
at node_modules/tslib/tslib.js:18:0 in <global>
at http://192.168.1.2:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:116838:35 in rejected
以下是我尝试实现签名的方式:
const SignUp = () => {
const [phoneNumber, setPhoneNumber] = useState("")
const recaptchaVerifier = React.useRef(null);
const auth = getAuth(app)
const sendCode = async () => {
console.log(recaptchaVerifier.current)
signInWithPhoneNumber(auth, phoneNumber, recaptchaVerifier.current!)
.then(r => {
console.log("Hej!")
}).catch(err=>{
console.log(err)
})
}
return (
<SafeAreaView
style={tw.style('w-full')}>
<FirebaseRecaptchaVerifierModal
ref={recaptchaVerifier}
firebaseConfig={app.options}
attemptInvisibleVerification={true}
/>
<TextInput
style={tw.style('w-1/2', 'shadow', 'border', 'rounded', 'py-2', 'px-3', 'text-gray-700')}
onChangeText={setPhoneNumber}
keyboardType="phone-pad"
/>
<Button title={"Send Code"} onPress={sendCode}/>
</SafeAreaView>
)
}
export default SignUp
我也尝试过这样实现:
const phoneProvider = new PhoneAuthProvider(auth) const verificationId = await phoneProvider.verifyPhoneNumber(phoneNumber, recaptchaVerifier.current!)
但是我得到的结果是一样的。
我已经没有主意了,所以任何帮助都将不胜感激。
推荐答案
将您的Package.json中的"expo-firebase-recaptcha": "~2.0.2"
更改为"expo-firebase-recaptcha": "~2.1.0"
。然后运行yarn install
以获取最新更新。
这篇关于错误:验证器._Reset不是函数。尝试使用FireBase手机登录时,请响应本地和世博会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文