Jetpack Compose ModalBottomSheetLayuot close

355 Views Asked by At

I want to make my ModalBottomSheetLayout closable on swipe to bottom, but prevent closing it on outside area. I found that in order to prevent outside click close I should use confirmValueChange = { false }, but with this, swipe close do not work. How I can reach this feature for my bottom sheet? Also, I added tween animation, but the bottom sheet is still close and open without any animation. Below is the code of the sheetState

val sheetState = rememberModalBottomSheetState(
        initialValue = ModalBottomSheetValue.Hidden,
        animationSpec = tween(
            durationMillis = 2000,
            delayMillis = 0,
            easing = FastOutSlowInEasing
        ),
        confirmValueChange = { bottomSheetValue ->
            false
        }
    )
0

There are 0 best solutions below