I’m declaring an `AnimatedNavHost` which has many ...
# compose
n
I’m declaring an
AnimatedNavHost
which has many screens and the first one is the
HomeScreen
.
HomeScreen
has another
NavHost
to implement the navigation between the bottom navigation tabs. Here’s the steps to reproduce: 1. Select second tab in
HomeScreen
(or any other tab but the first) 2. Navigate to another screen declared inside the
AnimatedNavHost
(let’s say
DetailsTab2Screen
3. Press back. So the
HomeScreen
is displayed again with the second tab selected. 4. Press back again. The first tab of the
HomeScreen
is selected. 5. Press back again. The expected result is: the application must be closed The actual result is: the user has to press the back button again to leave the app. And if you repeat the steps 2 and 3, N times, the user has to press the back key N + 2 times to leave the app. Any thoughts?
👀 1
🧵 1
i
This sounds exactly like https://issuetracker.google.com/issues/195668143 which is fixed for the upcoming alpha10 release
👍 2
n
Thanks @Ian Lake! I really didn’t want to control the visibility of top and bottom bars. But if this is fixed on the next version, I’m happy 🙂 Any idea when the alpha10 will be released?
k
@nglauber Genuinely interested, are you actually using new
NavHost
inside your home screen, or are you using
navigation
inside the origin AnimatedNavHost?
n
@K Merle yes… Basically I’m following the instruction described here: https://developer.android.com/jetpack/compose/navigation#bottom-nav But this screen is part of another NavHost. Which I really like to have this option of nested NavHosts. Allows me to keep the code more organized imho.
k
Yea, I am waiting for this fix too. Modifying visibility of top and bottom navigation sounds wrong imo.
👏 1
n
In my current implementation I have in app module one NavHost pointing to a NavHost for each feature. This is working great so far.
k
Generally, this is how I find some other web frameworks to work. You can have a completely different module that looks just like your root module but it has its own autonomy, especially in regards to navigating his own sub-routes.