0

I am implementing a practice application in react-native for IOS. I am using NavigatorIOS for navigation. I want to remove first route from navigation stack after successful login so that user won't come back. I am using .replace() function for this purpose and it replaces the route but navigation title remains unchanged.

Here are Images and related code to explain scenario.

  1. Login screen

    <NavigatorIOS style={styles.container} initialRoute={{ title: 'LOGIN', component: LoginScreen }}/>

enter image description here

  1. After successful login app navigates to home screen which should have title 'HOME' as specified in code

    this.props.navigator.replace({ title: 'HOME', component: HomeScreen, passProps: {token: responseData.token} });

enter image description here

  1. Next navigating to news, it still shows login on the back button. I just used push() method to push new view to stack.

    enter image description here

  2. Here is the main issue I am concerned with and cannot understand why this is happening. When is press back button viz '< LOGIN' it navigates to home screen and its title also changes to "HOME".

on returning back to home screen from child view

I do not get this behavior. Does anyone have idea why it is happening and how can I fix this thing. Help will be much appreciated.

tmw
  • 1,424
  • 1
  • 15
  • 26
  • Duplicate of [this question](http://stackoverflow.com/questions/29767977/react-navigatorios-not-updating-title-on-replace) – G. Hamaide Feb 18 '16 at 12:30

1 Answers1

1

This is a known RN bug. You can track it here.

I suggest you use Navigator instead.

G. Hamaide
  • 7,078
  • 2
  • 36
  • 57
  • can you point me to some example of usage of navigator. I didn't get quite well from official docs on the other hand navigatorIOS is quite simple to use – tmw Feb 18 '16 at 13:44
  • Check [here](http://stackoverflow.com/questions/32918666/example-of-navigation-between-views-in-react-native-android) – G. Hamaide Feb 18 '16 at 13:45