I have a funny problem.
When I press sign-up button, the function below is called in SignUp component.
//SignUp.js
signUpHandler = () => {
if (this.state.email == '' || this.state.password == '') {
alert("Email or Password is empty.")
}
else {
firebase.auth().createUserWithEmailAndPassword(this.state.email, this.state.password)
.then(() => this.props.navigation.navigate('ExtendedRegisteration'))
.catch(error => { alert(error.message) });
}
}
Now this doesn't navigate to "ExtendedRegisteration" but when I do the below, it navigates just fine.
//SignUp.js
signUpHandler = () => {
if (this.state.email == '' || this.state.password == '') {
alert("Email or Password is empty.")
}
else {
this.props.navigation.navigate('ExtendedRegisteration')
}
}
Is this a problem with Firebase? I need to navigate to "ExtendedRegisteration" after I signup using firebase.
Output from this.props in signUpHandler :
Object {
"navigation": Object {
"addListener": [Function addListener],
"canGoBack": [Function canGoBack],
"dangerouslyGetParent": [Function dangerouslyGetParent],
"dangerouslyGetState": [Function anonymous],
"dispatch": [Function dispatch],
"goBack": [Function anonymous],
"isFocused": [Function isFocused],
"jumpTo": [Function anonymous],
"navigate": [Function anonymous],
"pop": [Function anonymous],
"popToTop": [Function anonymous],
"push": [Function anonymous],
"removeListener": [Function removeListener],
"replace": [Function anonymous],
"reset": [Function anonymous],
"setOptions": [Function setOptions],
"setParams": [Function anonymous],
},
"route": Object {
"key": "Sign Up-q-zIoH0VCp",
"name": "Sign Up",
"params": undefined,
},
}