https://kotlinlang.org logo
#compose
Title
# compose
j

Jason Ankers

03/08/2021, 7:44 AM
How could I prevent scroll gestures from a
LazyColumn
inside a bottom sheet from dismissing the sheet? is it possible to disable the sheet swipe gestures within a certain boundary? (in my case I want to disable them over the
LazyColumn
)
m

Mayank Saini

09/21/2021, 6:02 AM
@Ian Lake Is there a way to achieve this? I am facing similar issue
Copy code
val bottomSheetScaffoldState =
    rememberModalBottomSheetState(ModalBottomSheetValue.Hidden, confirmStateChange = {
        it != ModalBottomSheetValue.Hidden
    })
This way the sheet won’t be dismissed but it still changes position which I don’t want,
j

Jason Ankers

09/21/2021, 6:10 AM
This is an old question, you could do something like this to disable nested scroll:
Copy code
Modifier.nestedScroll(remember {
    object : NestedScrollConnection {
        override fun onPostScroll(
            consumed: Offset,
            available: Offset,
            source: NestedScrollSource
        ) = available

        override suspend fun onPostFling(
            consumed: Velocity,
            available: Velocity,
        ) = available
    }
})
👍 1
m

Mayank Saini

09/21/2021, 7:10 AM
Thanks, It works.
13 Views