Vaibhav Jaiswal
05/02/2024, 1:41 PMhandleBackButton
seems to not be working with bottom sheets, I have these 2 use cases, in which back button does not work
• When I use SlotNavigation to show a bottom sheet
• When i use StackNavigation inside a BottomSheetArkadii Ivanov
05/02/2024, 1:48 PMArkadii Ivanov
05/02/2024, 1:51 PMVaibhav Jaiswal
05/02/2024, 1:56 PMval navigation = SlotNavigation<DuplicateNewsConfig>()
internal val slot = component.childSlot(
source = navigation,
handleBackButton = true,
serializer = DuplicateNewsConfig.serializer()
) { config, context ->
DuplicateNewsComponent(config.newsId, context) { news ->
navigation.dismiss {
if (!it) return@dismiss
onNewsSelect(news)
}
}
}
And this is how I display the sheet
duplicateNewsSlot.child?.instance?.also {
val sheetState = rememberModalBottomSheetState()
DuplicateNewsBottomSheet(
component = it,
sheetState = sheetState,
onDismiss = {
scope.launch { sheetState.hide() }
.invokeOnCompletion { component.onDuplicateNewsDismiss() }
}
)
}
Arkadii Ivanov
05/02/2024, 2:04 PMonDismiss
should work? Or is it not working? If the Composable DuplicateNewsBottomSheet installs BackHandler {}
, then it would intercept the Child Slot's handleBackButton
, I guess. Would it be possible to provide a complete reproducer project?Vaibhav Jaiswal
05/02/2024, 2:12 PMVaibhav Jaiswal
05/02/2024, 2:29 PMArkadii Ivanov
05/02/2024, 2:36 PMArkadii Ivanov
05/02/2024, 2:37 PMVaibhav Jaiswal
05/02/2024, 2:38 PMArkadii Ivanov
05/02/2024, 2:44 PMArkadii Ivanov
05/02/2024, 2:44 PMVaibhav Jaiswal
05/02/2024, 2:51 PMVaibhav Jaiswal
05/02/2024, 2:52 PMVaibhav Jaiswal
05/02/2024, 2:52 PMVaibhav Jaiswal
05/02/2024, 2:52 PMArkadii Ivanov
05/02/2024, 3:01 PMArkadii Ivanov
05/02/2024, 3:01 PMVaibhav Jaiswal
05/02/2024, 3:02 PM