Skip to content

Instantly share code, notes, and snippets.

@chiragthummar
Created August 18, 2023 05:42
Show Gist options
  • Save chiragthummar/b870079f36dc297a86516ee62a849d41 to your computer and use it in GitHub Desktop.
Save chiragthummar/b870079f36dc297a86516ee62a849d41 to your computer and use it in GitHub Desktop.
@Composable
fun NestedNavigationExample() {
val navController = rememberNavController()
NavHost(
navController = navController,
startDestination = Screens.Home.route
) {
navigation(
startDestination = Screens.Home.Login.route,
route = Screens.Home.route
) {
composable(route = Screens.Home.Login.route) {
LoginScreen {
navController.navigate(it)
}
}
composable(route = Screens.Home.Register.route) {
RegisterScreen {
navController.navigate(it)
}
}
}
composable(route = Screens.Dashboard.route) {
DashboardScreen {
navController.navigate(it)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment