Marko Novakovic
08/01/2022, 4:10 PMModalBottomSheetLayout
sheetContent
never leaves composition. is tracking offset the only way to observe is it visible or not?MR3Y
08/01/2022, 5:56 PMModalBottomSheetState#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()Marko Novakovic
08/02/2022, 9:27 AMjossiwolf
08/02/2022, 11:33 AMisVisible
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 🙂Marko Novakovic
08/02/2022, 11:43 AM