Hi, do you have any idea, how to disable Half-Expa...
# compose
r
Hi, do you have any idea, how to disable Half-Expanded state in ModalBottomSheetLayout? I want to switch only between collapsed and expanded states.
j
Here's a hacky thing:
Copy code
LaunchedEffect(sheetState) {
with(sheetState) {
        val isOpening = value == ModalBottomSheetValue.Hidden &&
            targetValue == ModalBottomSheetValue.HalfExpanded
        val isClosing = value == ModalBottomSheetValue.Expanded &&
            targetValue == ModalBottomSheetValue.HalfExpanded
        when {
            isOpening -> animateTo(ModalBottomSheetValue.Expanded)
            isClosing -> animateTo(ModalBottomSheetValue.Hidden)
        }
    }
}
r
Thanks 👍