https://kotlinlang.org logo
#compose
Title
# compose
r

Robert Menke

11/01/2020, 8:14 PM
Does navigation-compose currently support nested `NavHost`s? My use case is that I have a sign up flow and I’d like to move to a bottom navigation view when the user signs in. Following the docs the
Scaffold
with bottom navigation uses a NavHostController to define each screen in the bottom navigation. When I declare my 2nd nav host I get the error
Copy code
java.lang.IllegalStateException: ViewModelStore should be set before setGraph call
i

Ian Lake

11/01/2020, 8:16 PM
You need to use a separate
rememberNavController()
for the inner one
But that's generally the wrong thing to do: just don't emit your bottom nav when you're on your login destinations
r

Robert Menke

11/01/2020, 8:17 PM
Figured that out right after I typed that question out 🤦‍♂️ thanks @Ian Lake 🙂
Ahh ok I see!
4 Views