检查电话号码是否存在(如果存在错误)并在otp之前检查
signIn() {
this.setState({ waiting: true });
firebase
.auth()
.signInWithPhoneNumber(this.state.phoneNumber)
//if phone number is right, then update phone in store and call verify code screen
.then(res => {
Store.currentUserPhone = this.state.phoneNumber;
Actions.VerifyCode({ result: res });
})
.catch(error => this.setState({ error: error.message, waiting: false
}));
}
答案 0 :(得分:0)
您可以使用
检查用户身份验证对象是否有phoneNumber值const userAuth = firebase.auth().currentUser;
if(userAuth.phoneNumber !== undefined) {
//user has phone number
}else {
//user does not have phone number
}