Skip to content

Commit

Permalink
Change default back to position: "relative" (#1469)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/react-native#41480

Pull Request resolved: #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
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Nov 14, 2023
1 parent f1435c8 commit 3eef585
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/YGDefaultValuesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion yoga/style/Style.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ class YG_EXPORT Style {
Align alignContent_ : bitCount<Align>() = Align::FlexStart;
Align alignItems_ : bitCount<Align>() = Align::Stretch;
Align alignSelf_ : bitCount<Align>() = Align::Auto;
PositionType positionType_ : bitCount<PositionType>() = PositionType::Static;
PositionType positionType_
: bitCount<PositionType>() = PositionType::Relative;
Wrap flexWrap_ : bitCount<Wrap>() = Wrap::NoWrap;
Overflow overflow_ : bitCount<Overflow>() = Overflow::Visible;
Display display_ : bitCount<Display>() = Display::Flex;
Expand Down

0 comments on commit 3eef585

Please sign in to comment.