`ModalBottomSheetLayout` `sheetContent` never leav...
# compose
m
ModalBottomSheetLayout
sheetContent
never leaves composition. is tracking offset the only way to observe is it visible or not?
m
there is a
ModalBottomSheetState#isVisible
property to check if the bottomSheet is currently visible or hidden https://developer.android.com/reference/kotlin/androidx/compose/material/ModalBottomSheetState#isVisible(). Also, you can use `currentValue`(that is used by
isVisible
under the hood) to check for the intermediate states like
HalfExpanded
. https://developer.android.com/reference/kotlin/androidx/compose/material/SwipeableState#currentValue()
m
thanks. I should’ve make myself more clear. I need something observable state.
j
isVisible
reads from
currentValue
which is backed by snapshot state. If you read
isVisible
in any context that tracks state reads (Composition or i.e.
snapshotFlow
) you will receive updates to it 🙂
m
oh thanks