Nested navigation
TabNavigator + Navigator
For more complex use cases, when each tab should have its own independent navigation, like the Youtube app, you can combine the TabNavigator
with multiple Navigator
s.
Let's go back to the Tab navigation example.
But now, the HomeTab
will have it's own Navigator
.
That way, we can use the LocalNavigator
to navigate deeper into HomeTab
, or the LocalTabNavigator
to switch between tabs.
Nested Navigators
Going a little further, it's possible to have nested navigators. The Navigator
has a level
property (so you can check how deeper your are) and can have a parent
navigator (if you need to interact with it).
Another operation is the popUntilRoot()
, it will recursively pop all screens starting from the leaf navigator until the root one.
Sample
Source code here.
Last updated