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

How can I hide the navigation bar? #25

Open
pgmemk opened this issue Nov 7, 2015 · 11 comments
Open

How can I hide the navigation bar? #25

pgmemk opened this issue Nov 7, 2015 · 11 comments

Comments

@pgmemk
Copy link

pgmemk commented Nov 7, 2015

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?

@patrick91
Copy link

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

@aksonov
Copy link

aksonov commented Dec 8, 2015

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

@ide
Copy link
Member

ide commented Dec 8, 2015

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

@aksonov
Copy link

aksonov commented Dec 8, 2015

How to access to current route from custom navigator bar?

Pavel.

8 дек. 2015 г., в 18:46, James Ide notifications@github.com написал(а):

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.

@ide
Copy link
Member

ide commented Dec 8, 2015

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.

@aksonov
Copy link

aksonov commented Dec 8, 2015

I tried to return null from rendernavigatorbar but it doesn't hide it. Abe example ?

Pavel.

8 дек. 2015 г., в 18:52, Pavlo Aksonov aksonov@gmail.com написал(а):

How to access to current route from custom navigator bar?

Pavel.

8 дек. 2015 г., в 18:46, James Ide notifications@github.com написал(а):

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.

@ide
Copy link
Member

ide commented Dec 8, 2015

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.

@aksonov
Copy link

aksonov commented Dec 9, 2015

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

@aksonov
Copy link

aksonov commented Dec 9, 2015

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

@ide
Copy link
Member

ide commented Dec 9, 2015

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

@fxhereng
Copy link

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.

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

5 participants