Skip to content

Commit 5a56a23

Browse files
authored
Merge pull request #88 from Konyaco/update_tab_row_layout
[fluent] Fix: Prevent TabView from exceeding its bounds
2 parents eec0334 + 67ee464 commit 5a56a23

File tree

2 files changed

+3
-1
lines changed
  • fluent/src/commonMain/kotlin/com/konyaco/fluent/component
  • gallery/src/commonMain/kotlin/com/konyaco/fluent/gallery/screen/navigation

2 files changed

+3
-1
lines changed

fluent/src/commonMain/kotlin/com/konyaco/fluent/component/TabView.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.size
2020
import androidx.compose.foundation.layout.widthIn
2121
import androidx.compose.foundation.layout.wrapContentHeight
2222
import androidx.compose.foundation.layout.wrapContentSize
23+
import androidx.compose.foundation.layout.wrapContentWidth
2324
import androidx.compose.foundation.lazy.LazyListItemInfo
2425
import androidx.compose.foundation.lazy.LazyListScope
2526
import androidx.compose.foundation.lazy.LazyListState
@@ -154,6 +155,7 @@ fun TabRow(
154155
modifier = Modifier
155156
.onGloballyPositioned { rowRect.value = it.boundsInParent() }
156157
.weight(1f)
158+
.wrapContentWidth(Alignment.Start)
157159
.height(TabViewHeight)
158160
.zIndex(1f)
159161
)

gallery/src/commonMain/kotlin/com/konyaco/fluent/gallery/screen/navigation/TabViewScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ internal fun TabViewWindowContent(
151151
) {
152152
Column(modifier = Modifier.windowInsetsPadding(paddingInsets)) {
153153
val selectedIndex = remember { mutableStateOf(1) }
154-
val tabItems = remember { mutableStateListOf(*Array(100) { it + 1 }) }
154+
val tabItems = remember { mutableStateListOf(*Array(6) { it + 1 }) }
155155
val state = rememberLazyListState()
156156
val endDividerController = rememberTabItemEndDividerController(
157157
selectedKey = { selectedIndex.value },

0 commit comments

Comments
 (0)