https://kotlinlang.org logo
#compose
Title
# compose
z

zoha131

11/14/2020, 10:20 PM
Have anyone tried nested navigation? When I make the nested navigation the startDestination then it works otherwise I can’t go to the nested navigation. How can I navigate to the nested navigation?
Copy code
ShohayTheme {
                val navController = rememberNavController()

                NavHost(navController = navController, startDestination = Route.Splash) {
                    composable(Route.Splash) {
                        val splashViewModel = hiltViewModel<SplashViewModel>()
                        SplashScreen(
                            viewModel = splashViewModel,
                            navigateToAuth = { navController.navigate(Route.Auth) },
                            navigateToHome = { navController.navigate(Route.Main) }
                        )
                    }

                    navigation(startDestination = Route.NestedAuth.Social, route = Route.Auth){
                        composable(Route.NestedAuth.Social) {
                            Text(text = "Social Flow")
                        }
                    }

                    composable(Route.Main) {
                        Text(text = "Main Flow")
                    }
                }

            }
🧵 1
i

Ian Lake

11/15/2020, 2:09 AM
What do you mean by "you can't go to the nested navigation"? Do you get some error?
z

zoha131

11/15/2020, 3:45 PM
App crashes whenever I try to navigate to the nested graph. Unfortunately AS does not show any fatal issue on the console. but I got the following issue from crashlytics:
Copy code
Fatal Exception: java.lang.IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest{ uri=<android-app://androidx.navigation.compose/Auth> } cannot be found in the navigation graph NavGraph(0x0) startDestination={Destination(0xa12eb830)}
       at androidx.navigation.NavController.navigate(NavController.java:1031)
       at androidx.navigation.NavController.navigate(NavController.java:1008)
       at androidx.navigation.compose.NavHostControllerKt.navigate(NavHostController.kt:107)
       at androidx.navigation.compose.NavHostControllerKt.navigate$default(NavHostController.kt:106)
       at bd.com.shohay.app.MainActivity$onCreate$1$1$1$1$1.invoke(MainActivity.kt:33)
       at bd.com.shohay.app.MainActivity$onCreate$1$1$1$1$1.invoke()
       at bd.com.shohay.app.ui.splash.SplashScreenKt$SplashScreen$2$1.invoke(SplashScreen.kt:50)
       at bd.com.shohay.app.ui.splash.SplashScreenKt$SplashScreen$2$1.invoke(:3)
       at androidx.compose.runtime.PreCommitScopeImpl.onEnter(Effects.kt:55)
       at androidx.compose.runtime.Composer$LifecycleEventDispatcher.dispatchLifecycleObservers(Composer.kt:751)
       at androidx.compose.runtime.Composer.applyChanges(Composer.kt:808)
       at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:296)
       at androidx.compose.runtime.Recomposer.access$performRecompose()
       at androidx.compose.runtime.Recomposer$recomposeAndApplyChanges$2$2.invoke(Recomposer.kt:228)
       at androidx.compose.runtime.Recomposer$recomposeAndApplyChanges$2$2.invoke(:7)
       at androidx.compose.runtime.dispatch.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.kt:34)
       at androidx.compose.runtime.dispatch.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.kt:111)
       at androidx.compose.runtime.dispatch.AndroidUiDispatcher.access$performFrameDispatch()
       at androidx.compose.runtime.dispatch.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.kt:71)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1007)
       at android.view.Choreographer.doCallbacks(Choreographer.java:821)
       at android.view.Choreographer.doFrame(Choreographer.java:753)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
       at android.os.Handler.handleCallback(Handler.java:873)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:201)
       at android.app.ActivityThread.main(ActivityThread.java:6826)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
i

Ian Lake

11/15/2020, 3:54 PM
It would be helpful if you could file an issue with a reproduction project: https://issuetracker.google.com/issues/new?component=409828&amp;template=1093757
z

zoha131

11/15/2020, 4:02 PM
I would do that shortly.
i

Ian Lake

11/19/2020, 5:45 PM
Thanks, I've routed it over to the right person. We'll take a look
8 Views