Tim Malseed
03/03/2022, 9:07 AMBottomNavigationItem(
...,
selected = currentDestination?.hierarchy?.any { it.route == screen.route } == true,
My nav hierarchy looks like so:
NavHost {
navGraphA()
navGraphB()
navGraphC()
}
Where A, B and C represent top-level bottom navigation graphs.
fun NavGraphBuilder.screenAGraph(navController: NavController) {
navigation(
startDestination = "screen_a",
route = "screen_a_graph"
) {
composable("screen_a_graph") {
ScreenA(onClick = { navController.navigate("screen_b") })
}
screenBGraph()
}
}
fun NavGraphBuilder.screenBGraph() {
composable(
route = "screen_b"
) {
ScreenB()
}
}
When I navigate to Screen B, it seems that neither screen_a
nor screen_a_graph
are present in the currentDestination.hierarchy
I’ve searched this chat and Googled around but I just can’t seem to find an answer. Am I approaching this the wrong way?