I am building a user Authentication page for my react native app. Issues I can't update the displayName while signing up my user. After that I need to store the name, email,password in my Firestore database.
I am using expo and firebase. I can't understand why it is not working.
import firebase from "firebase";
import { auth } from "../../firebase";
const SignUpScreen = () => {
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
// const user = firebase.auth().currentUser;
// Sign Up ----------
const handleSignUp = () => {
auth
.createUserWithEmailAndPassword(email, password)
.then((userCredentials) => {
if (userCredentials) {
const user = userCredentials.user;
user.updateProfile({
displayName: name,
});
}
})
.then((userCredentials) => {
const user = userCredentials.user;
// console.log("Registered with:", user.email);
})
.catch((error) => alert(error.message));
};