Reputation: 1807
Making a simple firebase auth app with react-native. Register/sign in works just fine, but I can't get the sign out to work properly.
loginUser = (email,password) => {
try{
firebase.auth().signInWithEmailAndPassword(email, password).then(function(user){
console.log(user)
})
}
catch(error){
console.log(error.toString())
}
}
signOutUser = () => firebase.auth.signOut();
The sign out button is easy as this:
<Button style={styles.button}
full
rounded
onPress={() => this.signOutUser()}
>
Upvotes: 3
Views: 21628
Reputation: 1775
In your code you have firebase.auth.signOut()
and auth
here is a function, therefore it should've been firebase.auth().signOut()
Upvotes: 1
Reputation: 712
Your function to sign users out is called signOutUser
but you call a function named deleteAccount
when your button is pressed.
Try:
onPress={() => this.signOutUser()}
Also you may need to change the signOutUser function to:
firebase.auth().signOut().then(function() {
// Sign-out successful.
}).catch(function(error) {
// An error happened.
});
Upvotes: 13
Reputation: 5272
Your function is named signOutUser
in your code, but your HTML is trying to call a function named deleteAccount
.
If you have a different deleteAccount
we'll need you to show us that too.
Upvotes: 1