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

Navigator navigationBar renders at bottom of screen #1278

Closed
esauter5 opened this issue May 14, 2015 · 3 comments
Closed

Navigator navigationBar renders at bottom of screen #1278

esauter5 opened this issue May 14, 2015 · 3 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@esauter5
Copy link
Contributor

I just implemented a Navigator component with a custom navigationBar. When it renders, the navBar renders at the bottom of the screen, but otherwise renders correctly. I noticed that this is because in the code, navBar renders after the scene: https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/Navigator/Navigator.js#L1318-L1321

I noticed that Navigator.NavigationBar gets around this by setting the navBar component to position: absolute (https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js#L190-L195)

Would it make sense to have the navbar render first so that it was at the top by default? I can turn open a PR if so.

@jmstout
Copy link
Contributor

jmstout commented May 15, 2015

I would imagine part of the reason the navbar is rendered after the scene is so it appears on top of the scene, rather than below it.

As far as I understand it, the component order is basically equivalent to z-index in css.

@esauter5
Copy link
Contributor Author

Thanks @jmstout. If this is true, then it makes sense. I realized the flaw in my logic: I was pondering the navbar being on top for a screen that didnt scroll so it seemed natural. If the screen did scroll, the navbar would go away unless you have the absolute positioning. Not sure how I overlooked that. Going to close.

@mattvagni
Copy link

📢 For anyone else ending up on this still (like me) an easy way to reverse the order is to simply add flexDirection: 'column-reverse' to the Navigator.

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants