NavHost
Last updated
Last updated
Let's suppose we have a bottom tab navigation and we want to switch between the tabs and keep their history. Guia allows that behavior using a NavHost
:
First we declare our different keys for each stack (or tab):
Then we can create our navigators and our nav host:
Then we can render our NavHost
state using NavHost.NavContainer
:
As you can see we can have different nav container params based on our stack key.
To switch which navigator is currently active we can use setActive
:
We can also directly navigate using the NavHost
using currentNavigator
or navigator(key)
functions: