React-native-firebase phone 认证

React-native-firebase phone authentication

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

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

这是抛出错误的代码

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

现在您正在获取 const 中的结果值。返回值不是函数。

您可以使用此代码

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

}