Vladimir
08/18/2024, 5:28 PMVladimir
08/18/2024, 5:35 PMonNavigateToHomeScreen= { navController.navigate(Home) }
) into individual screens through the navigation graph? Is there a way to avoid this problem and perhaps still be able to modularize the routes while having them inside a nested graph?Vladimir
08/18/2024, 5:50 PM@Composable
fun AppNavHost(
navController: NavHostController,
startDestination: Any
) {
NavHost(navController = navController, startDestination = startDestination) {
mainScreenGraph(onNavigateToScanScreen = { navController.navigate(ScreenA) })
featureAScreenGraph()
featureBScreenGraph()
loginScreenGraph()
}
}
a) If I were to pass down all kinds of onNavigate()
functions from AppNavHost
wouldn't it make this file bloated?
Also, the inner feature nested graphs would need to instantiate all the viewmodels that all the Screens inside them require. I am not sure if that is a good thing?