File tree Expand file tree Collapse file tree
composeunstyled-bottom-sheet/src/commonMain/kotlin/com/composeunstyled Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -279,6 +279,7 @@ class BottomSheetState internal constructor(
279279 private var sheetHeightDependentDetents: Set <SheetDetent > by mutableStateOf(emptySet())
280280 private var sheetHeightDependencyContainerHeightPx = Float .NaN
281281 private var sheetHeightDependencyDetents: List <SheetDetent > = emptyList()
282+ private var measuredContentHeightPx = Float .NaN
282283 private var measuredSheetHeightPx: Float by mutableStateOf(Float .NaN )
283284 internal var maxDetentHeightPx: Float by mutableStateOf(Float .NaN )
284285 internal var isDragging: Boolean by mutableStateOf(false )
@@ -525,8 +526,11 @@ class BottomSheetState internal constructor(
525526 }
526527
527528 internal fun updateContentHeight (measuredHeightPx : Float , includeMeasuredSheetHeight : Boolean ) {
529+ val measuredContentHeightShrank = measuredContentHeightPx.isNaN().not () &&
530+ measuredHeightPx < measuredContentHeightPx
531+ measuredContentHeightPx = measuredHeightPx
528532 val shouldIncludeMeasuredSheetHeight = includeMeasuredSheetHeight ||
529- measuredSheetHeightPx < containerHeightPx
533+ (measuredContentHeightShrank. not () && measuredSheetHeightPx < containerHeightPx)
530534 val measuredSheetHeight = if (shouldIncludeMeasuredSheetHeight) {
531535 measuredSheetHeightPx.takeUnless { it.isNaN() } ? : 0f
532536 } else {
You can’t perform that action at this time.
0 commit comments