Closed WonderCsabo closed 7 months ago
Description When there is a nested navigation, the topmost bottom sheet does not gets the back event, the nested navigatitor pops instead.
Steps to reproduce
class MainActivity : ComponentActivity() { @OptIn(ExperimentalMaterialNavigationApi::class) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { AppTheme { Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { val bottomSheetNavigator = rememberBottomSheetNavigator() val topNavController = rememberNavController(bottomSheetNavigator) ModalBottomSheetLayout(bottomSheetNavigator) { NavHost(navController = topNavController, startDestination = "root") { composable("root") { Root(topNavController) } bottomSheet("dialog") { Dialog() } } } } } } } } @Composable fun Root(topNavController: NavController) { Column { Button(onClick = { topNavController.navigate("dialog") }) { Text(text = "open dialog") } val nestedNavController = rememberNavController() NavHost(navController = nestedNavController, startDestination = "nested1", modifier = Modifier.weight(1f)) { composable("nested1") { Nested1(nestedNavController) } composable("nested2") { Nested2() } } } } @Composable fun Nested1(nestedNavController: NavController) { Button(onClick = { nestedNavController.navigate("nested2") }) { Text(text = "Open nested2 screen") } } @Composable fun Nested2() { Text(text = "nested2") } @Composable fun Dialog() { Text("My Dialog") }
Expected behavior The bottom sheet closes.
Additional context Bottom sheet stays visible, under it we navigate back to nested1 screen.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This is still an issue.
Description When there is a nested navigation, the topmost bottom sheet does not gets the back event, the nested navigatitor pops instead.
Steps to reproduce
Expected behavior The bottom sheet closes.
Additional context Bottom sheet stays visible, under it we navigate back to nested1 screen.