I have created a Jetpack compose navigation as follows:
val navController = rememberNavController()
Scaffold(
bottomBar = { /* BottomBar code here */ }
){ innerPadding ->
NavHost(
navController = navController,
startDestination = "navigation",
modifier = Modifier.padding(innerPadding)
){
composable("home") { Log.d(TAG, "Show home screen") }
composable("account") { Log.d(TAG, "Show account screen") }
composable("settings") { Log.d(TAG, "Show settings screen") }
}
}
My problem is when ever I click on a nav item, the log message on the composable()
function is printed twice per click in logcat. I may have missed something on the documentation. Why is this happening & how can I fix it?