首页 > 解决方案 > 为什么即使我正确输入了我的基本代码,我的注册页面也不起作用

问题描述

当我尝试注册时出现此错误

this.props.firebase.signupwithemail 不是函数。(在'_this.props.firebase.signupWithEmail(email,password)', '_this.props.firebase.signupWithEmail'未定义)

这是我的代码

handleOnSignup = async (values, actions) => {
const { name, email, password } = values

try {
  const response = await this.props.firebase.signupWithEmail(
    email,
    password
  )

  if (response.user.uid) {
    const { uid } = response.user
    const userData = { email, name, uid }
    await this.props.firebase.createNewUser(userData)
    this.props.navigation.navigate('App')
  }
} catch (error) {
  // console.error(error)
  actions.setFieldError('general', error.message)
} finally {
  actions.setSubmitting(false)
}

标签: javascriptfirebasefirebase-authenticationexpo

解决方案


改变这个:

this.props.firebase.signInWithEmail

进入这个:

this.props.firebase.signInWithEmailAndPassword

推荐阅读