Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/react-native/React/Views/RCTLayout.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ UIUserInterfaceLayoutDirection RCTUIKitLayoutDirectionFromYogaLayoutDirection(YG
YGDisplay RCTYogaDisplayTypeFromReactDisplayType(RCTDisplayType displayType)
{
switch (displayType) {
case RCTDisplayTypeNone:
return YGDisplayNone;
case RCTDisplayTypeFlex:
return YGDisplayFlex;
case RCTDisplayTypeNone:
return YGDisplayNone;
case RCTDisplayTypeInline:
RCTAssert(NO, @"RCTDisplayTypeInline cannot be converted to YGDisplay value.");
return YGDisplayNone;
Expand All @@ -128,11 +128,10 @@ RCTDisplayType RCTReactDisplayTypeFromYogaDisplayType(YGDisplay displayType)
{
switch (displayType) {
case YGDisplayFlex:
case YGDisplayContents:
case YGDisplayGrid:
return RCTDisplayTypeFlex;
case YGDisplayNone:
return RCTDisplayTypeNone;
case YGDisplayContents:
RCTAssert(NO, @"YGDisplayContents cannot be converted to RCTDisplayType value.");
return RCTDisplayTypeNone;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public enum YogaAlign {
BASELINE(5),
SPACE_BETWEEN(6),
SPACE_AROUND(7),
SPACE_EVENLY(8);
SPACE_EVENLY(8),
START(9),
END(10);

private final int mIntValue;

Expand All @@ -41,6 +43,8 @@ public static YogaAlign fromInt(int value) {
case 6: return SPACE_BETWEEN;
case 7: return SPACE_AROUND;
case 8: return SPACE_EVENLY;
case 9: return START;
case 10: return END;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
public enum YogaDisplay {
FLEX(0),
NONE(1),
CONTENTS(2);
CONTENTS(2),
GRID(3);

private final int mIntValue;

Expand All @@ -29,6 +30,7 @@ public static YogaDisplay fromInt(int value) {
case 0: return FLEX;
case 1: return NONE;
case 2: return CONTENTS;
case 3: return GRID;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// @generated by enums.py

package com.facebook.yoga;

public enum YogaGridTrackType {
AUTO(0),
POINTS(1),
PERCENT(2),
FR(3),
MINMAX(4);

private final int mIntValue;

YogaGridTrackType(int intValue) {
mIntValue = intValue;
}

public int intValue() {
return mIntValue;
}

public static YogaGridTrackType fromInt(int value) {
switch (value) {
case 0: return AUTO;
case 1: return POINTS;
case 2: return PERCENT;
case 3: return FR;
case 4: return MINMAX;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
package com.facebook.yoga;

public enum YogaJustify {
FLEX_START(0),
CENTER(1),
FLEX_END(2),
SPACE_BETWEEN(3),
SPACE_AROUND(4),
SPACE_EVENLY(5);
AUTO(0),
FLEX_START(1),
CENTER(2),
FLEX_END(3),
SPACE_BETWEEN(4),
SPACE_AROUND(5),
SPACE_EVENLY(6),
STRETCH(7),
START(8),
END(9);

private final int mIntValue;

Expand All @@ -29,12 +33,16 @@ public int intValue() {

public static YogaJustify fromInt(int value) {
switch (value) {
case 0: return FLEX_START;
case 1: return CENTER;
case 2: return FLEX_END;
case 3: return SPACE_BETWEEN;
case 4: return SPACE_AROUND;
case 5: return SPACE_EVENLY;
case 0: return AUTO;
case 1: return FLEX_START;
case 2: return CENTER;
case 3: return FLEX_END;
case 4: return SPACE_BETWEEN;
case 5: return SPACE_AROUND;
case 6: return SPACE_EVENLY;
case 7: return STRETCH;
case 8: return START;
case 9: return END;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ inline DisplayType displayTypeFromYGDisplay(YGDisplay display)
return DisplayType::Contents;
case YGDisplayFlex:
return DisplayType::Flex;
case YGDisplayGrid:
return DisplayType::Grid;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum class DisplayType {
None = 0,
Flex = 1,
Contents = 2,
Grid = 3,
};

enum class PositionType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ inline int toInt(const DisplayType &displayType)
return 1;
case DisplayType::Contents:
return 2;
case DisplayType::Grid:
return 3;
}
}

Expand All @@ -56,6 +58,8 @@ inline std::string toString(const DisplayType &displayType)
return "flex";
case DisplayType::Contents:
return "contents";
case DisplayType::Grid:
return "grid";
}
}

Expand Down
30 changes: 30 additions & 0 deletions packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const char* YGAlignToString(const YGAlign value) {
return "space-around";
case YGAlignSpaceEvenly:
return "space-evenly";
case YGAlignStart:
return "start";
case YGAlignEnd:
return "end";
}
return "unknown";
}
Expand Down Expand Up @@ -73,6 +77,8 @@ const char* YGDisplayToString(const YGDisplay value) {
return "none";
case YGDisplayContents:
return "contents";
case YGDisplayGrid:
return "grid";
}
return "unknown";
}
Expand Down Expand Up @@ -141,6 +147,22 @@ const char* YGFlexDirectionToString(const YGFlexDirection value) {
return "unknown";
}

const char* YGGridTrackTypeToString(const YGGridTrackType value) {
switch (value) {
case YGGridTrackTypeAuto:
return "auto";
case YGGridTrackTypePoints:
return "points";
case YGGridTrackTypePercent:
return "percent";
case YGGridTrackTypeFr:
return "fr";
case YGGridTrackTypeMinmax:
return "minmax";
}
return "unknown";
}

const char* YGGutterToString(const YGGutter value) {
switch (value) {
case YGGutterColumn:
Expand All @@ -155,6 +177,8 @@ const char* YGGutterToString(const YGGutter value) {

const char* YGJustifyToString(const YGJustify value) {
switch (value) {
case YGJustifyAuto:
return "auto";
case YGJustifyFlexStart:
return "flex-start";
case YGJustifyCenter:
Expand All @@ -167,6 +191,12 @@ const char* YGJustifyToString(const YGJustify value) {
return "space-around";
case YGJustifySpaceEvenly:
return "space-evenly";
case YGJustifyStretch:
return "stretch";
case YGJustifyStart:
return "start";
case YGJustifyEnd:
return "end";
}
return "unknown";
}
Expand Down
21 changes: 18 additions & 3 deletions packages/react-native/ReactCommon/yoga/yoga/YGEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ YG_ENUM_DECL(
YGAlignBaseline,
YGAlignSpaceBetween,
YGAlignSpaceAround,
YGAlignSpaceEvenly)
YGAlignSpaceEvenly,
YGAlignStart,
YGAlignEnd)

YG_ENUM_DECL(
YGBoxSizing,
Expand All @@ -44,7 +46,8 @@ YG_ENUM_DECL(
YGDisplay,
YGDisplayFlex,
YGDisplayNone,
YGDisplayContents)
YGDisplayContents,
YGDisplayGrid)

YG_ENUM_DECL(
YGEdge,
Expand Down Expand Up @@ -79,6 +82,14 @@ YG_ENUM_DECL(
YGFlexDirectionRow,
YGFlexDirectionRowReverse)

YG_ENUM_DECL(
YGGridTrackType,
YGGridTrackTypeAuto,
YGGridTrackTypePoints,
YGGridTrackTypePercent,
YGGridTrackTypeFr,
YGGridTrackTypeMinmax)

YG_ENUM_DECL(
YGGutter,
YGGutterColumn,
Expand All @@ -87,12 +98,16 @@ YG_ENUM_DECL(

YG_ENUM_DECL(
YGJustify,
YGJustifyAuto,
YGJustifyFlexStart,
YGJustifyCenter,
YGJustifyFlexEnd,
YGJustifySpaceBetween,
YGJustifySpaceAround,
YGJustifySpaceEvenly)
YGJustifySpaceEvenly,
YGJustifyStretch,
YGJustifyStart,
YGJustifyEnd)

YG_ENUM_DECL(
YGLogLevel,
Expand Down
Loading
Loading