Hi! How is this problem solved? Help me please:fac...
# compose
a
Hi! How is this problem solved? Help me please🫣
Copy code
@Composable
fun NavigationGraph(
    navController: NavHostController
) {
    NavHost(navController, startDestination = Navigation.First.route) {
        /* shown after Navigation.Notification screen, but it is expected to be first */
        composable(Navigation.First.route) {
            //...
        }

        composable(Navigation.Second.route) {
            //...
        }
    }
    LaunchedEffect(Unit) {
        /* shown before startDestination screen, but it is expected after Navigation.First */
        navController.navigate(Navigation.Notification.route)
    }
}
a
Hi @Andrey Kachur it looks like you would like to create a nested graph, try something like this
Copy code
@Composable
fun NavigationGraph(
    navController: NavHostController
) {
    val nestedNavController = rememberNavController()
    NavHost(nestedNavController, startDestination = Navigation.First.route) {
        /* shown after Navigation.Notification screen, but it is expected to be first */
        composable(Navigation.First.route) {
            //...
            // TODO use your navController to go the parent graph
        }

        composable(Navigation.Second.route) {
            //...
        }
    }
    LaunchedEffect(Unit) {
        /* shown before startDestination screen, but it is expected after Navigation.First */
        nestedNavController.navigate(Navigation.Notification.route)
    }
}
a
if you insert delay(500) into "launchedeffect" before calling navigation, it works (dirty hack)
this is not a nested graph, just navcontroller is declared outside the composable function