gts13
06/14/2023, 9:23 AMBackHandler
and dialog properties:
dialogProperties = DialogProperties(
usePlatformDefaultWidth = false,
dismissOnBackPress = false,
dismissOnClickOutside = false
)
Any idea? 🙄bryankeltonadams
10/10/2023, 9:56 PMOleksandr Balan
10/11/2023, 7:17 AMModalBottomSheetWindow
, which has this code to handle back press:
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BACK) {
if (keyDispatcherState == null) {
return super.dispatchKeyEvent(event)
}
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) {
val state = keyDispatcherState
state?.startTracking(event, this)
return true
} else if (event.action == KeyEvent.ACTION_UP) {
val state = keyDispatcherState
if (state != null && state.isTracking(event) && !event.isCanceled) {
onDismissRequest()
return true
}
}
}
return super.dispatchKeyEvent(event)
}
So it always handles back button and invokes onDismissRequest
, where it does the following:
onDismissRequest = {
if (sheetState.currentValue == Expanded && sheetState.hasPartiallyExpandedState) {
scope.launch { sheetState.partialExpand() }
} else { // Is expanded without collapsed state or is collapsed.
scope.launch { sheetState.hide() }.invokeOnCompletion { onDismissRequest() }
}
},
Thus hides or partially collapses the modal bottom sheet and now there are no customization options 😕
I guess you can give a ⭐ to this issue: https://issuetracker.google.com/issues/278216859bryankeltonadams
10/11/2023, 4:30 PMbryankeltonadams
10/11/2023, 4:38 PM