diff --git a/lib/yoga/src/main/cpp/yoga/YGEnums.cpp b/lib/yoga/src/main/cpp/yoga/YGEnums.cpp index b5916ca1ecf..77e5c802376 100644 --- a/lib/yoga/src/main/cpp/yoga/YGEnums.cpp +++ b/lib/yoga/src/main/cpp/yoga/YGEnums.cpp @@ -27,6 +27,8 @@ const char* YGAlignToString(const YGAlign value) { return "space-between"; case YGAlignSpaceAround: return "space-around"; + case YGAlignSpaceEvenly: + return "space-evenly"; } return "unknown"; } diff --git a/lib/yoga/src/main/cpp/yoga/YGEnums.h b/lib/yoga/src/main/cpp/yoga/YGEnums.h index 55bbe9fc9d8..ef09668c811 100644 --- a/lib/yoga/src/main/cpp/yoga/YGEnums.h +++ b/lib/yoga/src/main/cpp/yoga/YGEnums.h @@ -21,7 +21,8 @@ YG_ENUM_SEQ_DECL( YGAlignStretch, YGAlignBaseline, YGAlignSpaceBetween, - YGAlignSpaceAround) + YGAlignSpaceAround, + YGAlignSpaceEvenly) YG_ENUM_SEQ_DECL( YGDimension, diff --git a/lib/yoga/src/main/cpp/yoga/algorithm/CalculateLayout.cpp b/lib/yoga/src/main/cpp/yoga/algorithm/CalculateLayout.cpp index 570070d047f..59360ff76cd 100644 --- a/lib/yoga/src/main/cpp/yoga/algorithm/CalculateLayout.cpp +++ b/lib/yoga/src/main/cpp/yoga/algorithm/CalculateLayout.cpp @@ -2036,6 +2036,18 @@ static void calculateLayoutImpl( currentLead += remainingAlignContentDim / 2; } break; + case Align::SpaceEvenly: + if (availableInnerCrossDim > totalLineCrossDim) { + currentLead += + remainingAlignContentDim / static_cast(lineCount + 1); + if (lineCount > 1) { + crossDimLead = + remainingAlignContentDim / static_cast(lineCount + 1); + } + } else { + currentLead += remainingAlignContentDim / 2; + } + break; case Align::SpaceBetween: if (availableInnerCrossDim > totalLineCrossDim && lineCount > 1) { crossDimLead = @@ -2192,6 +2204,7 @@ static void calculateLayoutImpl( case Align::Auto: case Align::SpaceBetween: case Align::SpaceAround: + case Align::SpaceEvenly: break; } } diff --git a/lib/yoga/src/main/cpp/yoga/enums/Align.h b/lib/yoga/src/main/cpp/yoga/enums/Align.h index 95df12a7903..67777fc31b4 100644 --- a/lib/yoga/src/main/cpp/yoga/enums/Align.h +++ b/lib/yoga/src/main/cpp/yoga/enums/Align.h @@ -24,16 +24,17 @@ enum class Align : uint8_t { Baseline = YGAlignBaseline, SpaceBetween = YGAlignSpaceBetween, SpaceAround = YGAlignSpaceAround, + SpaceEvenly = YGAlignSpaceEvenly, }; template <> constexpr inline int32_t ordinalCount() { - return 8; + return 9; } template <> constexpr inline int32_t bitCount() { - return 3; + return 4; } constexpr inline Align scopedEnum(YGAlign unscoped) { diff --git a/lib/yoga/src/main/java/com/facebook/yoga/YogaAlign.java b/lib/yoga/src/main/java/com/facebook/yoga/YogaAlign.java index a60d77e0f29..00535154fca 100644 --- a/lib/yoga/src/main/java/com/facebook/yoga/YogaAlign.java +++ b/lib/yoga/src/main/java/com/facebook/yoga/YogaAlign.java @@ -17,7 +17,8 @@ public enum YogaAlign { STRETCH(4), BASELINE(5), SPACE_BETWEEN(6), - SPACE_AROUND(7); + SPACE_AROUND(7), + SPACE_EVENLY(8); private final int mIntValue; @@ -39,6 +40,7 @@ public static YogaAlign fromInt(int value) { case 5: return BASELINE; case 6: return SPACE_BETWEEN; case 7: return SPACE_AROUND; + case 8: return SPACE_EVENLY; default: throw new IllegalArgumentException("Unknown enum value: " + value); } }