【发布时间】:2020-08-08 11:47:48
【问题描述】:
我想更新当前用户的 displayName 并将其显示在屏幕上。
firebase
.auth()
.createUserWithEmailAndPassword(email, password)
.then((response) => {response.user.updateProfile({displayName: 'John Doe'}),response.user.reload()})
.catch(error => Alert.alert('', error.message));
console.log(firebase.auth().currentUser.displayName);
使用此代码,它首先返回 null,但是当我重新加载应用程序时,它返回“John Doe”,我如何在不重新加载应用程序的情况下做到这一点。
【问题讨论】:
-
请不要多次转发同一个问题。相反,请对您最初发布的问题添加任何说明。它下面有一个方便的编辑链接,可以让你这样做。当您编辑您的问题时,它就有资格重新打开。
标签: javascript reactjs firebase react-native firebase-authentication