I'm using a NavigatorIOS component in my root component, and want to toggle between a login an register screen:
navToLogin() {
this.refs.nav.replace({
title: "Login",
component: LoginScene,
rightButtonTitle: "Sign Up",
onRightButtonPress: this.navToRegister.bind(this)
});
}
navToRegister() {
this.refs.nav.replace({
title: "Sign Up",
component: RegisterScene,
rightButtonTitle: "Login",
onRightButtonPress: this.navToLogin.bind(this)
});
}
render() {
return (
<NavigatorIOS
ref = "nav"
style={styles.navigator}
initialRoute={{
component: LoginScene,
title: "Login",
rightButtonTitle: "Sign Up",
onRightButtonPress: this.navToRegister.bind(this)
}}
/>
);
}
Although the view is updated properly, the title and rightButton do not change after the nav.replace() invocation. When I'm using nav.push() everything works as expected.
Am I using this component wrong somehow?
You're not using it wrong, this is a bug NavigatorIOS. If you can it's probably worth using Navigator instead as that's better supported (Facebook are actually using it themselves internally)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With