Skip to content

Commit

Permalink
WIP: Handle updating the bottom nav selected item when hitting back w…
Browse files Browse the repository at this point in the history
…hile on a different bottom tab
  • Loading branch information
christianrowlands committed Nov 2, 2024
1 parent 0140e3d commit 493208c
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ fun HomeScreen(
var showGnssFilterDialog by remember { mutableStateOf(false) }
var showGnssSortDialog by remember { mutableStateOf(false) }

bottomNavController.addOnDestinationChangedListener { _, destination, _ ->
BottomNavItem().bottomNavigationItems().forEachIndexed { index, item ->
// Only needed to update the selected item when hitting back from a bottom tab (which
// takes you to the dashboard tab)
if (destination.route == item.route) {
bottomNavSelectedItem = index
}
}
}

Scaffold(
topBar = {
AppBar(
Expand Down

0 comments on commit 493208c

Please sign in to comment.