diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[LTR].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[LTR].png index ebda8aa974..edd9c55f1c 100644 --- a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[LTR].png +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[LTR].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf2c950e21c16f1ba234681f69a7c1f7597d21418efa3669d5f0823c90278f26 -size 10217 +oid sha256:c147b56627d77f9382f1ce1ceecc1f614d146012d5dbab2eddcb035910a5dffc +size 10413 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[RTL].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[RTL].png index 787b543d36..665aa890b9 100644 --- a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[RTL].png +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[RTL].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47f6085e608f526972a4686d33190b56cea16883b822403f1ea170c6bef935f8 -size 10291 +oid sha256:b32cd8f7b42a336497d34d7eacb060e5ebf3fbfce1470b7d18f0412558e69db4 +size 10493 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png index a98bbd011e..d318b5ed28 100644 --- a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9bca3940fac5f97e68c4f739576dde64d481db472cc56aed60969df7dd5ddf13 -size 10240 +oid sha256:e6d00c455c7c923201f6b12cc6f739190e5d2585214ca00105ca49ee1fae0a1a +size 10618 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png index f075c132dd..f16f171e03 100644 --- a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f2ae8b6c781141c460143f3593e712c8f9e69817a536d3acb33f84b27b13d7f -size 10154 +oid sha256:57259e6fe0087d1720918af2371031739237cf44962cd7b66cae0acc6090295e +size 10384 diff --git a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt index f4503275ea..60a0c284d0 100644 --- a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt +++ b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt @@ -501,7 +501,7 @@ abstract class AbstractFlexContainerTest { fun testFlexDistributesWeightEqually() { val container = flexContainer(FlexDirection.Row) container.width(Constraint.Fill) - container.height(Constraint.Fill) + container.height(Constraint.Wrap) container.add(widget("REALLY LONG TEXT", FlexImpl(1.0))) container.add(widget("SHORTER TEXT", FlexImpl(1.0))) container.add(widget("A", FlexImpl(1.0))) @@ -513,7 +513,7 @@ abstract class AbstractFlexContainerTest { fun testFlexDistributesWeightUnequally() { val container = flexContainer(FlexDirection.Row) container.width(Constraint.Fill) - container.height(Constraint.Fill) + container.height(Constraint.Wrap) container.add(widget("REALLY LONG TEXT", FlexImpl(3.0))) container.add(widget("SHORTER TEXT", FlexImpl(1.0))) container.add(widget("A", FlexImpl(1.0))) diff --git a/redwood-layout-uiview/RedwoodLayoutUIViewTests/SnapshotTestingCallback.swift b/redwood-layout-uiview/RedwoodLayoutUIViewTests/SnapshotTestingCallback.swift index 41ab23050e..680b7f8bf3 100644 --- a/redwood-layout-uiview/RedwoodLayoutUIViewTests/SnapshotTestingCallback.swift +++ b/redwood-layout-uiview/RedwoodLayoutUIViewTests/SnapshotTestingCallback.swift @@ -14,6 +14,6 @@ final class SnapshotTestingCallback : UIViewSnapshotCallback { func verifySnapshot(view: UIView, name: String?) { // Set `record` to true to generate new snapshots. Be sure to revert that before committing! // Note that tests always fail when `record` is true. - assertSnapshot(of: view, as: .image, named: name, record: false, file: fileName, testName: testName) + assertSnapshot(of: view, as: .image, named: name, record: true, file: fileName, testName: testName) } } diff --git a/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightEqually.1.png b/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightEqually.1.png index 77873ba145..d7237c54ea 100644 --- a/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightEqually.1.png +++ b/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightEqually.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:08702e97effc63a8329e2b0c1b2765ae8c2424a47a9ee2afd2e783c589055d1e -size 73348 +oid sha256:eb21f1c26c85acbed82f28d79777e85e60f66b89f7d08c4d4846d578a2ca2165 +size 80568 diff --git a/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightUnequally.1.png b/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightUnequally.1.png index 6ec11a11aa..a510f07362 100644 --- a/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightUnequally.1.png +++ b/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightUnequally.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d89029ad74cdcddbd5dcb8ba78b8f573db455541847c28370ea6654adf445ec -size 73097 +oid sha256:7c61a21a66bd0540b9d05d8b5940056ebbbfdcf7708ed9e5a223ce74bce43e3e +size 81747 diff --git a/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainer.kt b/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainer.kt index ea7dbe5584..34fda77cb9 100644 --- a/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainer.kt +++ b/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainer.kt @@ -33,7 +33,7 @@ import platform.UIKit.UIView import platform.darwin.NSInteger internal class UIViewFlexContainer( - private val direction: FlexDirection, + direction: FlexDirection, ) : FlexContainer, ChangeListener { private val yogaView: YogaUIView = YogaUIView( applyModifier = { node, index -> @@ -42,7 +42,7 @@ internal class UIViewFlexContainer( ) override val value: UIView get() = yogaView override val children = UIViewChildren( - value, + parent = value, insert = { view, index -> yogaView.rootNode.children.add(index, view.asNode()) value.insertSubview(view, index.convert()) diff --git a/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/YogaUIView.kt b/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/YogaUIView.kt index 075a39db9d..ab81529d15 100644 --- a/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/YogaUIView.kt +++ b/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/YogaUIView.kt @@ -18,7 +18,7 @@ import platform.CoreGraphics.CGRectZero import platform.CoreGraphics.CGSize import platform.CoreGraphics.CGSizeMake import platform.UIKit.UIScrollView -import platform.UIKit.UIScrollViewContentInsetAdjustmentBehavior +import platform.UIKit.UIScrollViewContentInsetAdjustmentBehavior.UIScrollViewContentInsetAdjustmentNever import platform.UIKit.UIView import platform.UIKit.UIViewNoIntrinsicMetric @@ -31,10 +31,11 @@ internal class YogaUIView( var height = Constraint.Wrap init { - // TODO: Support Scroll Indicators + // TODO: Support scroll indicators. + scrollEnabled = false showsVerticalScrollIndicator = false showsHorizontalScrollIndicator = false - contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.UIScrollViewContentInsetAdjustmentNever + contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever } override fun intrinsicContentSize(): CValue { diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[LTR].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[LTR].png index ebda8aa974..0d67a0086c 100644 --- a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[LTR].png +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[LTR].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf2c950e21c16f1ba234681f69a7c1f7597d21418efa3669d5f0823c90278f26 -size 10217 +oid sha256:84f3b103484288013e8c90fe8b2786adcaf2b020e20a9d4c4c18767c091d655c +size 10311 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[RTL].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[RTL].png index 787b543d36..6acaf32f3a 100644 --- a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[RTL].png +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[RTL].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47f6085e608f526972a4686d33190b56cea16883b822403f1ea170c6bef935f8 -size 10291 +oid sha256:3d6c293f2758b0ef0b29cfa19ec1ca3cdbaabd8bb278df74e6aee774597bd85a +size 10376 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png index 51ef899710..281ba38386 100644 --- a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8211254756c6ef0608390d6ef17ff97f6994e17bed7fcbaf9441ed40d917baf1 -size 10318 +oid sha256:f7ee0dbd171c831c5d97ab85668a1b058b6105d9563bc4045012ea589acaf7bb +size 10403 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png index 57f1416310..3009a8c10a 100644 --- a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e5df9553cc1bb3e73a3df3c50cf33e6c98529cab0d1cecb4cad60d681a41da4 -size 10467 +oid sha256:1baab1f19bc24203320ba291078a1db0d5353962eb9a0afb3a2aaf62bcd5bdf7 +size 10561 diff --git a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt index 7bc6f95c5b..530f8832c0 100644 --- a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt +++ b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt @@ -1595,14 +1595,14 @@ internal object Yoga { ) val isMainAxisRow = YGFlexDirectionIsRow(mainAxis) val mainAxisSize = if (isMainAxisRow) width else height - val mainAxisownerSize = if (isMainAxisRow) ownerWidth else ownerHeight + val mainAxisOwnerSize = if (isMainAxisRow) ownerWidth else ownerHeight var childWidth: Float var childHeight: Float var childWidthMeasureMode: YGMeasureMode var childHeightMeasureMode: YGMeasureMode val resolvedFlexBasis = YGResolveValue( child.resolveFlexBasisPtr(), - mainAxisownerSize, + mainAxisOwnerSize, ) val isRowStyleDimDefined = YGNodeIsStyleDimDefined( child, YGFlexDirection.YGFlexDirectionRow,