Skip to content

Commit b8865d5

Browse files
authored
Try to fix common issue with the top app bar (#6187)
The exception is: > Size(720 x -83) is out of range. Each dimension must be between 0 and 16777215. So forcing the height to at least 0 should fix it (although it might cause UI glitches?)
1 parent d430f30 commit b8865d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/TopAppBarScrollBehaviorLayout.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fun TopAppBarScrollBehaviorLayout(
4545
val contentHeight = placeable.height.toFloat()
4646
scrollBehavior.state.heightOffsetLimit = -contentHeight
4747
val heightOffset = scrollBehavior.state.heightOffset
48-
val layoutHeight = (contentHeight + heightOffset).toInt()
48+
val layoutHeight = (contentHeight + heightOffset).toInt().coerceAtLeast(0)
4949
layout(placeable.width, layoutHeight) {
5050
placeable.place(0, heightOffset.toInt())
5151
}

0 commit comments

Comments
 (0)