Skip to content

Commit

Permalink
Add errata for fix to marginStart/End for row-reverse flex direction
Browse files Browse the repository at this point in the history
Summary:
This stack is ultimately aiming to solve facebook/yoga#1208

This adds an value to the Errata enum. I will use this to gate this fix as there is potential for users to rely on this bug or have a hack in place to fix it and this would be a breaking change.

Differential Revision: D50145273

fbshipit-source-id: 3a935fe1526e0bc5f8105c1de5d8fc1b6ec5a675
  • Loading branch information
Joe Vilches authored and facebook-github-bot committed Oct 12, 2023
1 parent 099a39c commit a5ddd5f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/yoga/src/main/cpp/yoga/YGEnums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ const char* YGErrataToString(const YGErrata value) {
return "none";
case YGErrataStretchFlexBasis:
return "stretch-flex-basis";
case YGErrataStartingEndingEdgeFromFlexDirection:
return "starting-ending-edge-from-flex-direction";
case YGErrataAll:
return "all";
case YGErrataClassic:
Expand Down
1 change: 1 addition & 0 deletions lib/yoga/src/main/cpp/yoga/YGEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ YG_ENUM_DECL(
YGErrata,
YGErrataNone = 0,
YGErrataStretchFlexBasis = 1,
YGErrataStartingEndingEdgeFromFlexDirection = 2,
YGErrataAll = 2147483647,
YGErrataClassic = 2147483646)
YG_DEFINE_ENUM_FLAG_OPERATORS(YGErrata)
Expand Down
5 changes: 3 additions & 2 deletions lib/yoga/src/main/cpp/yoga/enums/Errata.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace facebook::yoga {
enum class Errata : uint32_t {
None = YGErrataNone,
StretchFlexBasis = YGErrataStretchFlexBasis,
StartingEndingEdgeFromFlexDirection = YGErrataStartingEndingEdgeFromFlexDirection,
All = YGErrataAll,
Classic = YGErrataClassic,
};
Expand All @@ -26,12 +27,12 @@ YG_DEFINE_ENUM_FLAG_OPERATORS(Errata)

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

template <>
constexpr inline int32_t bitCount<Errata>() {
return 2;
return 3;
}

constexpr inline Errata scopedEnum(YGErrata unscoped) {
Expand Down
2 changes: 2 additions & 0 deletions lib/yoga/src/main/java/com/facebook/yoga/YogaErrata.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
public enum YogaErrata {
NONE(0),
STRETCH_FLEX_BASIS(1),
STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION(2),
ALL(2147483647),
CLASSIC(2147483646);

Expand All @@ -29,6 +30,7 @@ public static YogaErrata fromInt(int value) {
switch (value) {
case 0: return NONE;
case 1: return STRETCH_FLEX_BASIS;
case 2: return STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION;
case 2147483647: return ALL;
case 2147483646: return CLASSIC;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
Expand Down

0 comments on commit a5ddd5f

Please sign in to comment.