Simplify the navigator architecture
closed
satya164
closed
With 6.x you can use a single navigator for modals + regular screens, and also have headers for screens from drawer, bottom tabs etc. without having to nest a stack. This should significantly reduce how many navigators you need to nest.
Aron
When I initialized a project, I have to create a lot of navigators...
StackNavigator(With 'modal' style) { StackNavigator { TabNavigator { StackNavigator(For Show Headers only) { HomeScreen} } } }
Oh god, I already forgot how to go from here...
This is terrible when I create a new project...
Could you please make react-navigation easier to use?
Such as, I can configure that a screen has a title bar or bottom bar?
Instead of creating one after another navigator?
Thank you !!
Brent Vatne
Aron: can you elaborate on why you're not using screen-specific controls to change things like the title in the header? also what is a "bottom bar"?
Aron
Brent Vatne: Thank you for your reply! Yes I can use "screen-specific controls", but as you can see, I have to nest a lot of navigators one by one, I think this is terrible...
When I create a new project, the navigator architecture is a headache for me.
A Bottom bar can be a toolbar or tab bar on iOS.
I mean, could we use react-navigation easily?
Could we just configure a screen to have a header bar or bottom bar like Flutter does?
Thank you!
Brent Vatne
Aron: in my opinion react-navigation does a good job of balancing ease of use and power/control along with ability to provide types. we could certainly simplify the api a lot if we wanted to limit what you could accomplish with it or sacrificing type safety. keep in mind that there are many constraints to the problem, and what might seem perfect for a simple app would make it impossible to build something more complicated, so some tradeoffs need to be made. you could build a simpler api around react-navigation in userspace if you want - your own library that just wraps react-navigation to give it an api that you think is good for your uses.
if you have some concrete api proposals you shoudl open a rfc on http://github.com/react-navigation/rfcs
Aron
Brent Vatne: Yes, I agree that react-navigation is powerful and beautiful. But I hope react-navigation to make some optimizations on this, A lot of navigators are hurting my patience when I initializing a new project.
And I often forget which navigator should I put a router in, and what should each navigator to do...
Thank you very much