ex-navigator
ex-navigator copied to clipboard
How can I hide the navigation bar?
Thank you so much for creating the ExNavigator.
I am switching from Navigator to ExNavigator in our app in hopes to significantly improve transitions :). I have a need to hide a Navigation bar on some screens. Could you please add it? Or if it already is in the package please advice on how do I proceed about it?
There is a property on ExNavigator that is used to hide/show the navbar:
https://github.com/exponentjs/ex-navigator/blob/master/ExNavigator.js#L100
So you can do:
<ExNavigator
showNavigationBar={false} ... />
to hide the navigation bar :)
Is there any way to hide it only for first scene, but not second?
You have to write a custom navigation bar and hide it however you want to.
How to access to current route from custom navigator bar?
Pavel.
8 дек. 2015 г., в 18:46, James Ide [email protected] написал(а):
You have to write a custom navigation bar and hide it however you want to.
— Reply to this email directly or view it on GitHub.
I don't think that's built in but you could set 'global.currentRoute = route' in a focus handler. Then your nav bar would have access to it. The later you figure out how to not use a global. The idea here is that it's all just code; write whatever works for you.
I tried to return null from rendernavigatorbar but it doesn't hide it. Abe example ?
Pavel.
8 дек. 2015 г., в 18:52, Pavlo Aksonov [email protected] написал(а):
How to access to current route from custom navigator bar?
Pavel.
8 дек. 2015 г., в 18:46, James Ide [email protected] написал(а):
You have to write a custom navigation bar and hide it however you want to.
— Reply to this email directly or view it on GitHub.
You need to write a custom component that animates itself off the screen, or fades out. It seems like this is a popular request so maybe someone else has written an example of a hiding nav bar and can share it.
@ide It would be really great, if exNavigator passes navigator instance to navbar. This way i could found current route without any globals.
Currently i'm doing following, but it looks a little bit hacky: this.props.routeMapper._navigator
@aksonov The underlying facebook Navigator/NavigationBar doesn't pass in the Navigator instance so ExNavigator doesn't do it either. There is a renderNavigationBar
prop exposed which gives you some control over the NavigationBar component and might make it easier to get the Navigator reference into the NavigationBar without globals.
What I did to solve this was to call a ExNavigator child in a new route with showNavigationBar: false. I don't know if this is the best solution but it worked for me.