Skip to content

Commit

Permalink
Add flex-basis: 0 to the weight modifiers on JS DOM to be consist…
Browse files Browse the repository at this point in the history
…ent with the `androidx.compose` behavior
  • Loading branch information
ShreckYe committed Sep 10, 2024
1 parent 6690e85 commit 026d258
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ actual interface ColumnScope {
@FloatRange(from = 0.0, fromInclusive = false)
weight: Float
): Modifier =
with(platformValue) { platformModify { weight(weight) } }
with(platformValue) { platformModify { flexBasis0().weight(weight) } }

@Stable
actual fun Modifier.align(alignment: Alignment.Horizontal): Modifier =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.huanshankeji.compose.foundation.layout

import com.huanshankeji.compose.ui.PlatformModifier
import com.varabyte.kobweb.compose.ui.modifiers.flexBasis
import org.jetbrains.compose.web.css.px

fun PlatformModifier.flexBasis0() =
flexBasis(0.px)
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ actual interface RowScope {
@FloatRange(from = 0.0, fromInclusive = false)
weight: Float
): Modifier =
with(platformValue) { platformModify { weight(weight) } }
with(platformValue) { platformModify { flexBasis0().weight(weight) } }

@Stable
actual fun Modifier.align(alignment: Alignment.Vertical): Modifier =
Expand Down

0 comments on commit 026d258

Please sign in to comment.