From b8865d550dc32264ea610f08881763a7e7134600 Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Mon, 16 Feb 2026 09:42:41 +0100 Subject: [PATCH] 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?) --- .../designsystem/components/TopAppBarScrollBehaviorLayout.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/TopAppBarScrollBehaviorLayout.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/TopAppBarScrollBehaviorLayout.kt index 36e9547575..566c677766 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/TopAppBarScrollBehaviorLayout.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/TopAppBarScrollBehaviorLayout.kt @@ -45,7 +45,7 @@ fun TopAppBarScrollBehaviorLayout( val contentHeight = placeable.height.toFloat() scrollBehavior.state.heightOffsetLimit = -contentHeight val heightOffset = scrollBehavior.state.heightOffset - val layoutHeight = (contentHeight + heightOffset).toInt() + val layoutHeight = (contentHeight + heightOffset).toInt().coerceAtLeast(0) layout(placeable.width, layoutHeight) { placeable.place(0, heightOffset.toInt()) }