[英]How to update profile (displayName) firebase in React Native?
I found a problem to update profile firebase in React Native, I try to look for example but fails all, maybe you can give me advices or you can correct my script. 我在React Native中发现了更新配置文件Firebase的问题,我尝试举例,但全部失败,也许您可以给我建议或可以更正我的脚本。
firebase.auth().createUserWithEmailAndPassword(this.state.email, this.state.password)
.then(
(user)=>{
if(user){
user.updateProfile({
displayName: 'Frank S. Andrew'
}).then((s)=> {
this.props.navigation.navigate('Account');
})
}
})
.catch(function(error) {
alert(error.message);
});
I try to follow all examples, in the alert shows message 'user.updateProfile is not a function'. 我尝试遵循所有示例,在警报中显示消息“ user.updateProfile不是函数”。
Please anyone help me how to update profile (displayName) firebase in React Native. 请任何人帮助我如何在React Native中更新配置文件(displayName)Firebase。
Thanks. 谢谢。
The createUserWithEmailAndPassword
method returns a UserCredential
object . createUserWithEmailAndPassword
方法返回一个UserCredential
对象 。 This is not a User
itself, but has a user
property, which is a User
object . 这不是User
本身,而是具有 user
属性,它是User
对象 。
So what you need it: 因此,您需要什么:
firebase.auth().createUserWithEmailAndPassword(this.state.email, this.state.password)
.then((userCredentials)=>{
if(userCredentials.user){
userCredentials.user.updateProfile({
displayName: 'Frank S. Andrew'
}).then((s)=> {
this.props.navigation.navigate('Account');
})
}
})
.catch(function(error) {
alert(error.message);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.