Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double nav bar when using drawer #2833

Closed
rohitgoyal opened this issue Jan 26, 2018 · 6 comments
Closed

Double nav bar when using drawer #2833

rohitgoyal opened this issue Jan 26, 2018 · 6 comments

Comments

@rohitgoyal
Copy link

Version

  • react-native-router-flux 4.0.0-beta.24
  • react-native v0.51.0

Expected behaviour

Single navigation bar for any scene.

Actual behaviour

Double navigation bar for Home scene.

Steps to reproduce

render() {
    return <Router>
      <Scene key="root" hideNavBar={true} navigationBarStyle={{backgroundColor:global.constants.green_dark,borderBottomWidth:0}} navBarButtonColor='white'>
        <Scene key="drawer" title={'Drawer'} drawer contentComponent={SideMenu}
          drawerOpenRoute= 'DrawerOpen'
          drawerCloseRoute= 'DrawerClose'
          drawerToggleRoute= 'DrawerToggle'
        >
          <Scene key="main" >
            <Scene key="home" title={'Home'} component={Home} navigationBarStyle={{backgroundColor:'red'}}/>
          </Scene>
        </Scene>
        <Scene key="help" title="Help" component={Help} backTitle=" " hideNavBar={false} />
      </Scene>
    </Router>
  }

1
2
3

Because of this there is always bump in height of the Home scene whenever a new scene is opened or coming back from an opened scene.

Any ideas how can i avoid this?
I already read the suggestions on other similar issues and kept hideNavBar={true} for the root scene as suggested in those threads.

@rohitgoyal
Copy link
Author

@aksonov Can you help?

@UrielShimony
Copy link

UrielShimony commented Jan 26, 2018

your explanation for the problem is A bit confusing but i assume that the problem is when you call 'Action.home()' you need to empty your scene stack.
the function you need to call is Action.pop() and then Action.home or with Action.reset()

look at the action API Action.https://github.com/aksonov/react-native-router-flux/blob/master/docs/API.md#actions

if this is not the problem so try to rap Try to wrap differently the scenes and the drawer:"

image

@rohitgoyal
Copy link
Author

@UrielShimony
So the home scene is the initial scene which is wrapped in a drawer so technically the drawer scene is the first scene.
Now when i call Actions.help() it goes to the help scene but as you see in the pic my home scene creates another navigation bar in the process which gives the height bump on home scene.

@rohitgoyal
Copy link
Author

So now i have understood the issue more clearly.

So I am keeping hideNavbar = true for the initial scene and hideNavBar=false for all the other scenes.
now it all works accept during the transition from initial scene to some other scene and vice versa.
During the transition the navigation by default assumes to show the navBar and that is why there is bump in height as well. Because as soon as the transition gets completed initial scene hides the navBar.

Anybody faced this as well?

@rohitgoyal
Copy link
Author

rohitgoyal commented Jan 27, 2018

Issue got resolved by putting headerMode={'screen'}
Closing issue.

@nica0012
Copy link

Did you add this on the drawer or in the scene nested inside the drawer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants