首页 > 解决方案 > React-native-firebase 电话身份验证

问题描述

我目前正在使用 react-native-firebase/auth 进行电话身份验证我已经链接了所有内容并遵循了所有步骤,但是在提供确认码并运行模块提供的确认功能时出现此错误。

TypeError: Cannot read property 'native' of undefined
at confirm (ConfirmationResult.js:25)

这是引发错误的代码

    const { confirm } = await auth().signInWithPhoneNumber(`+1 ${number}`)
    confirm('123456')

标签: react-nativereact-native-firebase

解决方案


现在你在 const 中得到了结果值。返回的值不是函数。

您可以使用此代码

signIn = async () => {
    const { phoneNumber } = this.state;
  const confirm = await firebase.auth().signInWithPhoneNumber(phoneNumber)
  console.log(confirm);

}


推荐阅读