Hi :wave: Question on Compose Multiple back stack ...
# compose
k
Hi 👋 Question on Compose Multiple back stack approach. I follow the implementation close to the @/Ian Lake ’s document and “Now in android” sample (at that time of implementation). But NiA app has some behaviours (UX issues?) which is not acceptable to our product team. To avoid that, I made the Nav graph flat and changed the logic of identifying current selected tab. This worked pretty much fine till I hit the same issue as in NiA app in deeplink scenario. NiA app(Video attached in 🧵): 1. When you navigate to a sub-screen in one of other bottom tab’s hierarchy, the bottom tab selection moves to that tab automatically. 2. Then if you tap the previous selected tab, It becomes No-Operation from UX perspective. (Though in background it restores the backstack and reselects the tab based on hierarchy) Any suggestions to avoid NIA app’s above behaviour and recommendations on how to design Multi back stack UX? Mine is single NavController approach similar to NiA app and it is a big app so I can’t drastically change foundation.
Deeplink Issue in my app: Tabs [Home, Cart, Account, Notifications] Issue: When Deeplink to Cart Opens, Cart Tab is selected. Then when I click “Home” tab, it becomes No-Op. Cause: When Cart Deeplink opens, There is no backStack Map associated with Home Route. And on Home tab click, the backstack (including Cart) is saved as Home Route’s Stack and it get restored on navigation.
My current set up simplified (which has Deeplink issue and some edge cases) To set any bottom tab as selected, 1. Each tab has top level destination. 2. If the one of bottom tab is manually tapped, I save and restore the state. 3. From sub screen, If the destination to navigate is one of that top level destination, bottom tab selection is programatically switches to that and I won’t restore the previously store state.