ex-navigator icon indicating copy to clipboard operation
ex-navigator copied to clipboard

How can I hide the navigation bar?

Open pgmemk opened this issue 9 years ago • 11 comments

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?

pgmemk avatar Nov 07 '15 19:11 pgmemk

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 :)

patrick91 avatar Dec 06 '15 21:12 patrick91

Is there any way to hide it only for first scene, but not second?

aksonov avatar Dec 08 '15 09:12 aksonov

You have to write a custom navigation bar and hide it however you want to.

ide avatar Dec 08 '15 17:12 ide

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.

aksonov avatar Dec 08 '15 17:12 aksonov

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.

ide avatar Dec 08 '15 17:12 ide

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.

aksonov avatar Dec 08 '15 17:12 aksonov

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 avatar Dec 08 '15 17:12 ide

@ide It would be really great, if exNavigator passes navigator instance to navbar. This way i could found current route without any globals.

aksonov avatar Dec 09 '15 07:12 aksonov

Currently i'm doing following, but it looks a little bit hacky: this.props.routeMapper._navigator

aksonov avatar Dec 09 '15 08:12 aksonov

@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.

ide avatar Dec 09 '15 08:12 ide

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.

fxhereng avatar Dec 23 '15 10:12 fxhereng