Skip to content

Commit

Permalink
Add errata supporting changes to position: static (#41130)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/yoga#1434

Pull Request resolved: #41130

I will use this errata to gate my changes that actually make position: static behave like the web. We have future plans to make position: relative the default again but users could still have declared certain nodes as position: static, so I think this is needed regardless.

Reviewed By: NickGerleman

Differential Revision: D50506915

fbshipit-source-id: b0d9e6883167de6ff002352c9288053324464cb9
  • Loading branch information
joevilches authored and facebook-github-bot committed Oct 24, 2023
1 parent 755a7db commit 60297d5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum YogaErrata {
NONE(0),
STRETCH_FLEX_BASIS(1),
STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION(2),
POSITION_STATIC_BEHAVES_LIKE_RELATIVE(4),
ALL(2147483647),
CLASSIC(2147483646);

Expand All @@ -31,6 +32,7 @@ public static YogaErrata fromInt(int value) {
case 0: return NONE;
case 1: return STRETCH_FLEX_BASIS;
case 2: return STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION;
case 4: return POSITION_STATIC_BEHAVES_LIKE_RELATIVE;
case 2147483647: return ALL;
case 2147483646: return CLASSIC;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ const char* YGErrataToString(const YGErrata value) {
return "stretch-flex-basis";
case YGErrataStartingEndingEdgeFromFlexDirection:
return "starting-ending-edge-from-flex-direction";
case YGErrataPositionStaticBehavesLikeRelative:
return "position-static-behaves-like-relative";
case YGErrataAll:
return "all";
case YGErrataClassic:
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/ReactCommon/yoga/yoga/YGEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ YG_ENUM_DECL(
YGErrataNone = 0,
YGErrataStretchFlexBasis = 1,
YGErrataStartingEndingEdgeFromFlexDirection = 2,
YGErrataPositionStaticBehavesLikeRelative = 4,
YGErrataAll = 2147483647,
YGErrataClassic = 2147483646)
YG_DEFINE_ENUM_FLAG_OPERATORS(YGErrata)
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum class Errata : uint32_t {
None = YGErrataNone,
StretchFlexBasis = YGErrataStretchFlexBasis,
StartingEndingEdgeFromFlexDirection = YGErrataStartingEndingEdgeFromFlexDirection,
PositionStaticBehavesLikeRelative = YGErrataPositionStaticBehavesLikeRelative,
All = YGErrataAll,
Classic = YGErrataClassic,
};
Expand All @@ -27,7 +28,7 @@ YG_DEFINE_ENUM_FLAG_OPERATORS(Errata)

template <>
constexpr inline int32_t ordinalCount<Errata>() {
return 5;
return 6;
}

template <>
Expand Down

0 comments on commit 60297d5

Please sign in to comment.