Hello all, I have 3 BottomNavigationTabs and each ...
# compose
j
Hello all, I have 3 BottomNavigationTabs and each has its own "Container composable" that holds a navHost and controls its navigation within that tab. I am having trouble trying to retain the state of the current composable in view when I navigate to another tab and back. For instance I have tabs A,B,C. When navigating from A ->A1 -> A2 -> B and then back to A. It restarts from A when I would like it to resume from A2. Any information on how I can acheieve this?
i
You could wait ~a month when multiple back stacks becomes available: https://issuetracker.google.com/issues/80029773
👍 1
Otherwise you'll need to be hoist your NavControllers and NavGraphs up
j
Thank you for the information Ian, I appreciate it.
Hi @Ian Lake when navigating via bottom tab, I can maintain the stack for my start destination but no other tabs in my application.
Copy code
navController.navigate(tab.route) {
    popUpTo = navController.graph.startDestination
    launchSingleTop = true
is it currently possible to maintain the state of each tab?
i
You've exactly described what the issue I linked will allow you to do.
j
@Ian Lake Thanks Ian, I look forward to using it
r
I don't want to wait a month. Does this workaround work today? Or was there some insurmountable problem?