Hi guys, I'm working on a KMP project, but it is p...
# compose
m
Hi guys, I'm working on a KMP project, but it is probably a Compose problem. ModalBottomSheet + LazyColumn issue: Every other upward scroll dismisses the sheet instead of scrolling the list. Want it to only dismiss when LazyColumn is fully at top.
Copy code
ModalBottomSheet(
    onDismissRequest = onDismissRequest,
    dragHandle = {}
) {
    Box(modifier = Modifier.fillMaxSize().background(...)) {
        AnimatedContent(content) { 
            // switches between different screens, one has LazyColumn
            LazyColumn(modifier = Modifier.fillMaxSize()) {
                // scrollable content
            }
        }
    }
}
Tried: NestedScrollConnection with onPreScroll/onPostScroll consuming scroll when not at top, tracking scroll state with LaunchedEffect + canScrollBackward, applying nestedScroll to both Box and LazyColumn. Any ideas? 🙏
r
Hi, you have a fillMaxSize in the content of Modal, you can attach a capture of Compose Layout Inspector or preview wherever you click and you see that there is space between the modal and the LazyColumn, because otherwise you will always have that behaviour, which is to be expected in this case, I think.