Skip to content

Commit 7d747ba

Browse files
committed
fix(android): fix content height when sheet has 3 detents
1 parent d3770df commit 7d747ba

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

android/src/main/java/com/swmansion/rnscreens/bottomsheet/BottomSheetBehaviorExt.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ internal fun <T : View> BottomSheetBehavior<T>.useTwoDetents(
3434
internal fun <T : View> BottomSheetBehavior<T>.useThreeDetents(
3535
@BottomSheetBehavior.StableState state: Int? = null,
3636
firstHeight: Int? = null,
37+
thirdHeight: Int? = null,
3738
halfExpandedRatio: Float? = null,
3839
expandedOffsetFromTop: Int? = null,
3940
): BottomSheetBehavior<T> {
4041
skipCollapsed = false
4142
isFitToContents = false
4243
state?.let { this.state = state }
4344
firstHeight?.let { this.peekHeight = firstHeight }
45+
thirdHeight?.let { this.maxHeight = thirdHeight }
4446
halfExpandedRatio?.let { this.halfExpandedRatio = halfExpandedRatio }
4547
expandedOffsetFromTop?.let { this.expandedOffset = expandedOffsetFromTop }
4648
return this

android/src/main/java/com/swmansion/rnscreens/bottomsheet/SheetDelegate.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ class SheetDelegate(
168168
screen.sheetDetents.count(),
169169
),
170170
firstHeight = (screen.sheetDetents[0] * containerHeight).toInt(),
171+
thirdHeight = (screen.sheetDetents[2] * containerHeight).toInt(),
171172
halfExpandedRatio = screen.sheetDetents[1].toFloat(),
172173
expandedOffsetFromTop = ((1 - screen.sheetDetents[2]) * containerHeight).toInt(),
173174
)
@@ -229,6 +230,7 @@ class SheetDelegate(
229230
3 ->
230231
behavior.useThreeDetents(
231232
firstHeight = (screen.sheetDetents[0] * containerHeight).toInt(),
233+
thirdHeight = (screen.sheetDetents[2] * containerHeight).toInt(),
232234
halfExpandedRatio = screen.sheetDetents[1].toFloat(),
233235
expandedOffsetFromTop = ((1 - screen.sheetDetents[2]) * containerHeight).toInt(),
234236
)

0 commit comments

Comments
 (0)