I have a lazy column inside the bottom sheet. When I scroll the column up the sheet is also getting collapsed with it. I have tried setting sheetGesturesEnabled to false but it does not work in my case. Here is a code snippet.
@OptIn(ExperimentalAnimationApi::class, ExperimentalMaterialApi::class)
@Composable
fun SheetContent() {
Box(
Modifier
.fillMaxWidth()
.heightIn(min = screenHeight, max = screenHeight)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.height(rowHeight)
) {
LazyColumn() {
...
}
LazyColumn() {
...
}
LazyColumn() {
...
}
}
}
}
Adding Bottom sheet implementation here. I am guessing the problem must be with nested items i.e. lazy columns inside the sheet content.
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun BottomsheetScreen() {
val bottomSheetScaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = BottomSheetState(BottomSheetValue.Collapsed)
)
val coroutineScope = rememberCoroutineScope()
BottomSheetScaffold(
scaffoldState = bottomSheetScaffoldState,
sheetShape = RoundedCornerShape(32.dp, 32.dp),
sheetElevation = 8.dp,
sheetContent = {
SheetContent()
},
sheetPeekHeight = 0.dp,
sheetGesturesEnabled = false,
drawerGesturesEnabled = false
) {
Button(onClick = {
coroutineScope.launch {
if (bottomSheetScaffoldState.bottomSheetState.isCollapsed) {
bottomSheetScaffoldState.bottomSheetState.expand()
} else {
bottomSheetScaffoldState.bottomSheetState.collapse()
}
}
}) {
Text(text = "Expand/Collapse Bottom Sheet")
}
}
}