mirror of
https://github.com/status-im/react-native.git
synced 2025-02-15 02:47:42 +00:00
Add support for space-between and space-around on align-content
Summary: Adds the two missing alignments ```space-between``` and ```space-around``` for ```align-content``` . Those values are a noop on ```align-items``` in order to prevent a breaking changes for an additional enum. Fix #229 Closes https://github.com/facebook/yoga/pull/364 Reviewed By: gkassabli Differential Revision: D4528561 Pulled By: emilsjolander fbshipit-source-id: ea6291b6dd22cef05d9eec03893250d50371236e
This commit is contained in:
parent
427b92e210
commit
17604ec6fe
@ -18,7 +18,9 @@ public enum YogaAlign {
|
||||
CENTER(2),
|
||||
FLEX_END(3),
|
||||
STRETCH(4),
|
||||
BASELINE(5);
|
||||
BASELINE(5),
|
||||
SPACE_BETWEEN(6),
|
||||
SPACE_AROUND(7);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
@ -38,6 +40,8 @@ public enum YogaAlign {
|
||||
case 3: return FLEX_END;
|
||||
case 4: return STRETCH;
|
||||
case 5: return BASELINE;
|
||||
case 6: return SPACE_BETWEEN;
|
||||
case 7: return SPACE_AROUND;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
YG_EXTERN_C_BEGIN
|
||||
|
||||
#define YGAlignCount 6
|
||||
#define YGAlignCount 8
|
||||
typedef YG_ENUM_BEGIN(YGAlign) {
|
||||
YGAlignAuto,
|
||||
YGAlignFlexStart,
|
||||
@ -21,6 +21,8 @@ typedef YG_ENUM_BEGIN(YGAlign) {
|
||||
YGAlignFlexEnd,
|
||||
YGAlignStretch,
|
||||
YGAlignBaseline,
|
||||
YGAlignSpaceBetween,
|
||||
YGAlignSpaceAround,
|
||||
} YG_ENUM_END(YGAlign);
|
||||
|
||||
#define YGDimensionCount 2
|
||||
|
@ -2667,7 +2667,22 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||
break;
|
||||
case YGAlignStretch:
|
||||
if (availableInnerCrossDim > totalLineCrossDim) {
|
||||
crossDimLead = (remainingAlignContentDim / lineCount);
|
||||
crossDimLead = remainingAlignContentDim / lineCount;
|
||||
}
|
||||
break;
|
||||
case YGAlignSpaceAround:
|
||||
if (availableInnerCrossDim > totalLineCrossDim) {
|
||||
currentLead += remainingAlignContentDim / (2 * lineCount);
|
||||
if (lineCount > 1) {
|
||||
crossDimLead = remainingAlignContentDim / lineCount;
|
||||
}
|
||||
} else {
|
||||
currentLead += remainingAlignContentDim / 2;
|
||||
}
|
||||
break;
|
||||
case YGAlignSpaceBetween:
|
||||
if (availableInnerCrossDim > totalLineCrossDim && lineCount > 1) {
|
||||
crossDimLead = remainingAlignContentDim / (lineCount - 1);
|
||||
}
|
||||
break;
|
||||
case YGAlignAuto:
|
||||
@ -2755,6 +2770,8 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||
break;
|
||||
}
|
||||
case YGAlignAuto:
|
||||
case YGAlignSpaceBetween:
|
||||
case YGAlignSpaceAround:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user