How does one navigate screens controlled by bottom navigation and the bottom nav is in a screen in NavHost. The documentation it's pretty vague in this aspect. They implement a NavHost wc results in ViewModelStore should be set before setGraph call Exception
i
Ian Lake
11/10/2021, 8:54 PM
he bottom nav is in a screen in NavHost.
This doesn't make that much sense - generally the bottom nav is outside of the
NavHost
, which is what the docs show. What are you trying to accomplish?
Ian Lake
11/10/2021, 8:54 PM
We've seen one issue with that exception, but it was with someone nesting one
NavHost
within another
NavHost
but reusing the same
NavController
instance (you can't do that: each level needs its own
NavController
)
t
Tanaka
11/11/2021, 6:44 AM
@Ian Lake So I setup the main screen (in MainActivity) with NavHost wc wraps whole app. The idea it's to navigate to another screen wc has bottom nav. In docs, I saw another NavHost inside the screen hosting bottom nav. But the thing is, if I do that, setGraph exception is raised.
i
Ian Lake
11/11/2021, 2:19 PM
That's absolutely not what the docs do at all - can you link to where you think it is doing that? We always recommend a single NavHost, where you hide and show your bottom nav based on what destination you are on
t
Tanaka
11/12/2021, 5:10 PM
@Ian Lake Maybe I read wrong. I put NavHost at a higher level 😅, instead of Nav controller