diff --git a/app/design-system/design-system-hedvig/src/commonMain/kotlin/com/hedvig/android/design/system/hedvig/Tab.kt b/app/design-system/design-system-hedvig/src/commonMain/kotlin/com/hedvig/android/design/system/hedvig/Tab.kt index 626d7c086e..00ae34d394 100644 --- a/app/design-system/design-system-hedvig/src/commonMain/kotlin/com/hedvig/android/design/system/hedvig/Tab.kt +++ b/app/design-system/design-system-hedvig/src/commonMain/kotlin/com/hedvig/android/design/system/hedvig/Tab.kt @@ -232,7 +232,7 @@ private data class TabRowLayoutInformation( private val fixedItemHeight: Dp, private val numberOfItems: Int, ) : Density by layoutDensity { - val maxItemsPerRow = constraints.maxWidth / minItemWidth.roundToPx() + val maxItemsPerRow = (constraints.maxWidth / minItemWidth.roundToPx()).coerceAtLeast(1) val rowsRequired = (numberOfItems / maxItemsPerRow) + (if (numberOfItems % maxItemsPerRow == 0) 0 else 1) val realItemsPerRow: Int = if (rowsRequired == 1) { numberOfItems