so I'm using the latest versions of react native, firebase + react-native-form-validator. when I try to log in with an existing user with the right email and password everything is great, but, when I insert wrong email or password the app crashes and I get this error:
the relevant lines of code are:
state = { email: '', password: '', error: '', loading: false }
userLogin = () => {
this.setState({ loading: true });
this.validate({
email: { required: true, email: true },
password: { required: true, minlength: 5 }
});
if (this.isFormValid()) {
firebase.auth().signInWithEmailAndPassword(this.state.email, this.state.password)
.then(() => Actions.partyzmain())
.catch(setTimeout(() => {
this.setState({ error: 'Email or password are inccorect!', password: '', loading: false });
}, 5000));
}
else {
if (this.isFieldInError('password')) {
this.setState({ error: 'Wrong password!', password: '', loading: false });
}
if (this.isFieldInError('email')) {
this.setState({ error: 'Invalid email adress!', loading: false });
}
}
};
I set a .catch error and I really don't understand why isn't it working properly.
many thanks to the answers.