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?
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
K Merle
09/28/2021, 6:29 AM
@nglauber Genuinely interested, are you actually using new
NavHost
inside your home screen, or are you using
navigation
inside the origin AnimatedNavHost?
n
nglauber
09/28/2021, 12:50 PM
@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
K Merle
09/28/2021, 12:54 PM
Yea, I am waiting for this fix too. Modifying visibility of top and bottom navigation sounds wrong imo.
👏 1
n
nglauber
09/28/2021, 12:57 PM
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
K Merle
09/28/2021, 1:15 PM
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.