diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java index 87a15e8a186578..34a8922e06a628 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java @@ -17,7 +17,8 @@ public enum YogaJustify { CENTER(1), FLEX_END(2), SPACE_BETWEEN(3), - SPACE_AROUND(4); + SPACE_AROUND(4), + SPACE_EVENLY(5); private int mIntValue; @@ -36,6 +37,8 @@ public static YogaJustify fromInt(int value) { case 2: return FLEX_END; case 3: return SPACE_BETWEEN; case 4: return SPACE_AROUND; + case 5: + return SPACE_EVENLY; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } diff --git a/ReactCommon/yoga/yoga/YGEnums.cpp b/ReactCommon/yoga/yoga/YGEnums.cpp index 7baf5c26243020..af3c27cf387471 100644 --- a/ReactCommon/yoga/yoga/YGEnums.cpp +++ b/ReactCommon/yoga/yoga/YGEnums.cpp @@ -121,6 +121,8 @@ const char *YGJustifyToString(const YGJustify value){ return "space-between"; case YGJustifySpaceAround: return "space-around"; + case YGJustifySpaceEvenly: + return "space-evenly"; } return "unknown"; } diff --git a/ReactCommon/yoga/yoga/YGEnums.h b/ReactCommon/yoga/yoga/YGEnums.h index e12b9667be8f9c..89567b162ab6f2 100644 --- a/ReactCommon/yoga/yoga/YGEnums.h +++ b/ReactCommon/yoga/yoga/YGEnums.h @@ -77,13 +77,14 @@ typedef YG_ENUM_BEGIN(YGFlexDirection) { } YG_ENUM_END(YGFlexDirection); WIN_EXPORT const char *YGFlexDirectionToString(const YGFlexDirection value); -#define YGJustifyCount 5 -typedef YG_ENUM_BEGIN(YGJustify) { - YGJustifyFlexStart, - YGJustifyCenter, - YGJustifyFlexEnd, - YGJustifySpaceBetween, - YGJustifySpaceAround, +#define YGJustifyCount 6 +typedef YG_ENUM_BEGIN(YGJustify){ + YGJustifyFlexStart, + YGJustifyCenter, + YGJustifyFlexEnd, + YGJustifySpaceBetween, + YGJustifySpaceAround, + YGJustifySpaceEvenly, } YG_ENUM_END(YGJustify); WIN_EXPORT const char *YGJustifyToString(const YGJustify value); diff --git a/ReactCommon/yoga/yoga/Yoga.cpp b/ReactCommon/yoga/yoga/Yoga.cpp index ba5fb183f62a1a..a5274936456fc6 100644 --- a/ReactCommon/yoga/yoga/Yoga.cpp +++ b/ReactCommon/yoga/yoga/Yoga.cpp @@ -2447,6 +2447,11 @@ static void YGNodelayoutImpl(const YGNodeRef node, betweenMainDim = 0; } break; + case YGJustifySpaceEvenly: + // Space is distributed evenly across all elements + betweenMainDim = remainingFreeSpace / (itemsOnLine + 1); + leadingMainDim = betweenMainDim; + break; case YGJustifySpaceAround: // Space on the edges is half of the space between elements betweenMainDim = remainingFreeSpace / itemsOnLine;