Compose deeplinks not working with the nested NavH...
# compose-android
v
Compose deeplinks not working with the nested NavHosts. I have an app that has a HomeScreen, then a DrawerScreen (with few screens nested inside the drawer. in the diagram below i mentioned only 2 for simplicity) and a Detail screen outside the drawer [Nav Host] | - HomeScreen | - Drawer Screen [Nav Host] | -- -- Screen A | -- -- Screen B | - Detail Screen My Screen A has a deep link configured, But when i open the app through deep link it just opens to the HomeScreen. I saw few threads with mentioned we should not use Nested NavHosts. But Why? The Jetsnack sample app has nested navhost. NowinAndroid app has Nested NavHosts. If we should not use nested NavHosts. how to implement this structure without nested NavHost?. I read few threads that suggests to use shared elements in the case of bottom bar screen to achieve this structure...But i dont understand why we should not use Nested Navhosts?. Please help me with your suggestions.
s
Where does NowInAndroid have a nested NavHost?
v
s
That's for ListDetailPaneScaffold yeah. I don't think you'd be deep linking to a specific details pane destination in the first place.
For your case, it'd be hard to deep link to a specific destination of your drawer too. You can probably have a deep link to HomeScreen with some params so that when they're present you automatically open your drawer
v
So, having nested navHost in my case is fine. right?
And... Why not deeplink on listDetailPane... What if i have a article list and detail UI and i want to deep link to article detail. how to acheive that one...? Do we need to just deep link to the pane... if just to the pane.. how it will act in small screen sizes?
s

https://youtu.be/LTLQhC6VadI?si=6q1QYZDWgS8120VA

at 11:45 yeah this is covered here too, there are some rare scenarios where you may want to reach for nested NavHosts
I haven't had such use cases myself before, so I am afraid I'm not sure about what's the best way to go about it
v
That helps!! Thanks 👍
@Ian Lake I see in some threads that you said, Using nested nav hosts is not the right approach(in bottom nav bar). Any thoughts in my scenario with drawer?