From 3eef585541c6ac0fdc2b980c6ecd346849da463c Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 14 Nov 2023 11:23:56 -0800 Subject: [PATCH] Change default back to `position: "relative"` (#1469) Summary: X-link: https://github.com/facebook/react-native/pull/41480 Pull Request resolved: https://github.com/facebook/yoga/pull/1469 The previous version of static didn't do anything inside of Yoga. Now that we're making it do something, this changes the default back to relative so that users with no errata set don't see their deafult styles changing. Differential Revision: D51182955 fbshipit-source-id: aa77e1876e59b285cc5e7e5fbc8ace6e8316efec --- java/tests/com/facebook/yoga/YogaNodeStylePropertiesTest.java | 2 +- tests/YGDefaultValuesTest.cpp | 2 +- yoga/style/Style.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/java/tests/com/facebook/yoga/YogaNodeStylePropertiesTest.java b/java/tests/com/facebook/yoga/YogaNodeStylePropertiesTest.java index fadb875232..553c3ca09c 100644 --- a/java/tests/com/facebook/yoga/YogaNodeStylePropertiesTest.java +++ b/java/tests/com/facebook/yoga/YogaNodeStylePropertiesTest.java @@ -191,7 +191,7 @@ public void testAlignContentAffectsLayout() { public void testPositionTypeDefault() { final YogaNode node = createNode(); - assertEquals(YogaPositionType.STATIC, node.getPositionType()); + assertEquals(YogaPositionType.RELATIVE, node.getPositionType()); } @Test diff --git a/tests/YGDefaultValuesTest.cpp b/tests/YGDefaultValuesTest.cpp index 7124d3968d..2c72021ed3 100644 --- a/tests/YGDefaultValuesTest.cpp +++ b/tests/YGDefaultValuesTest.cpp @@ -20,7 +20,7 @@ TEST(YogaTest, assert_default_values) { ASSERT_EQ(YGAlignFlexStart, YGNodeStyleGetAlignContent(root)); ASSERT_EQ(YGAlignStretch, YGNodeStyleGetAlignItems(root)); ASSERT_EQ(YGAlignAuto, YGNodeStyleGetAlignSelf(root)); - ASSERT_EQ(YGPositionTypeStatic, YGNodeStyleGetPositionType(root)); + ASSERT_EQ(YGPositionTypeRelative, YGNodeStyleGetPositionType(root)); ASSERT_EQ(YGWrapNoWrap, YGNodeStyleGetFlexWrap(root)); ASSERT_EQ(YGOverflowVisible, YGNodeStyleGetOverflow(root)); ASSERT_FLOAT_EQ(0, YGNodeStyleGetFlexGrow(root)); diff --git a/yoga/style/Style.h b/yoga/style/Style.h index 30f631f279..530cbb75c3 100644 --- a/yoga/style/Style.h +++ b/yoga/style/Style.h @@ -270,7 +270,8 @@ class YG_EXPORT Style { Align alignContent_ : bitCount() = Align::FlexStart; Align alignItems_ : bitCount() = Align::Stretch; Align alignSelf_ : bitCount() = Align::Auto; - PositionType positionType_ : bitCount() = PositionType::Static; + PositionType positionType_ + : bitCount() = PositionType::Relative; Wrap flexWrap_ : bitCount() = Wrap::NoWrap; Overflow overflow_ : bitCount() = Overflow::Visible; Display display_ : bitCount() = Display::Flex;