I’m new in Jetpack Compose. I have problem with navigation. My main screen look like this:
fun NavGraphBuilder.mainNavGraph(
navController: NavHostController
) {
navigation(
startDestination = Screen.MainScreen.route,
route = MAIN_GRAPH_ROUTE
) {
composable(
route = Screen.ProfileScreen.route
) {
ProfileScreen(navController = navController)
}
composable(
route = Screen.MainScreen.route
) {
MainScreen(navController = navController)
}
}
}
MainScreen have bottom navigation bar with 4 screens and own navigation controller. When i want to navigate from one of child screen from bottom bar to profile screen i can’t, probably because they have 2 different controllers. I’m using Composable, not fragments or activities. Also i got this error:
FATAL EXCEPTION: main
Process: com.roadtrip.android, PID: 14737
java.lang.IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest{ uri=android-app://androidx.navigation/profile_screen } cannot be found in the navigation graph ComposeNavGraph(0x78d845ec) route=home startDestination={Destination(0x442b361f) route=home_screen}
Can someone help me or explain how to navigate from nested graphs to another. Thx in advance
Tried to put profile screen in main screen routes but didn’t work. Tried to navigate back to MAIN_GRAPH_ROUTE and then call profile screen, but didn’t work…