Hi I have an app module that uses NavHost and NavC...
# compose-android
k
Hi I have an app module that uses NavHost and NavController for navigation. The app has two main scenarios: a login module and a home module. After a successful login, I navigate to the home module, which includes a bottom navigation bar. Since the bottom navigation bar requires a Scaffold, I’m using Scaffold inside the home module. Given this setup, what is the best approach for structuring navigation? Should I use multiple NavHost instances, or is there a better way to manage navigation efficiently?
r
I had a similar problem. I was suggested to use one navhost. based on the destination hide the ui components you don't need or show them. The more recommended approach is to use shared element transition. I guess this is discussed some where in the past thread. I remember asking a similar question. @Stylianos Gakis can you add on!
s
I'd also just use the search functionality in slack. This has been discussed here tens of times by now, if not more.
v
thanks guys for reply me back. Are you taking about this thread https://kotlinlang.slack.com/archives/C04TPPEQKEJ/p1719982161255149
s
If you are overwhelmed by the amount of information, one thing you can do is just look at the replies by Ian Lake. It's a safe bet in my experience.
v
How does Shared element transition helps to avoid multiple navhost?
yeah sure, I'll look on Ian Lake replies
s
How does Shared element transition helps to avoid multiple navhost?
By allowing each screen to define themselves if they want the navigation elements to be present or not.
👍 2