Skip to content

Commit 026d258

Browse files
committed
Add flex-basis: 0 to the weight modifiers on JS DOM to be consistent with the androidx.compose behavior
1 parent 6690e85 commit 026d258

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

compose-multiplatform-common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/layout/Column.js.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ actual interface ColumnScope {
4242
@FloatRange(from = 0.0, fromInclusive = false)
4343
weight: Float
4444
): Modifier =
45-
with(platformValue) { platformModify { weight(weight) } }
45+
with(platformValue) { platformModify { flexBasis0().weight(weight) } }
4646

4747
@Stable
4848
actual fun Modifier.align(alignment: Alignment.Horizontal): Modifier =
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.huanshankeji.compose.foundation.layout
2+
3+
import com.huanshankeji.compose.ui.PlatformModifier
4+
import com.varabyte.kobweb.compose.ui.modifiers.flexBasis
5+
import org.jetbrains.compose.web.css.px
6+
7+
fun PlatformModifier.flexBasis0() =
8+
flexBasis(0.px)

compose-multiplatform-common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/layout/Row.js.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ actual interface RowScope {
4242
@FloatRange(from = 0.0, fromInclusive = false)
4343
weight: Float
4444
): Modifier =
45-
with(platformValue) { platformModify { weight(weight) } }
45+
with(platformValue) { platformModify { flexBasis0().weight(weight) } }
4646

4747
@Stable
4848
actual fun Modifier.align(alignment: Alignment.Vertical): Modifier =

0 commit comments

Comments
 (0)