Skip to content

Commit

Permalink
Bindings for alignContent: "space-evenly"
Browse files Browse the repository at this point in the history
Summary:
This adds Fabric and Paper bindings to support `alignContent: "space-evenly"` as implemented in facebook/yoga#1422

Changelog:
[General][Added] - Bindings for `alignContent: "space-evenly"`

Differential Revision: D50347978

fbshipit-source-id: 99a3ac3a4bd4c006586653a8f2de339411528aaa
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 16, 2023
1 parent dd3d5bc commit 68ea9e7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface FlexStyle {
| 'stretch'
| 'space-between'
| 'space-around'
| 'space-evenly'
| undefined;
alignItems?: FlexAlignType | undefined;
alignSelf?: 'auto' | FlexAlignType | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,8 @@ type ____LayoutStyle_Internal = $ReadOnly<{
| 'center'
| 'stretch'
| 'space-between'
| 'space-around',
| 'space-around'
| 'space-evenly',

/** `overflow` controls how children are measured and displayed.
* `overflow: hidden` causes views to be clipped while `overflow: scroll`
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native/React/Base/RCTConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,8 @@ + (NSPropertyList)NSPropertyList:(id)json
@"stretch" : @(YGAlignStretch),
@"baseline" : @(YGAlignBaseline),
@"space-between" : @(YGAlignSpaceBetween),
@"space-around" : @(YGAlignSpaceAround)
@"space-around" : @(YGAlignSpaceAround),
@"space-evenly" : @(YGAlignSpaceEvenly)
}),
YGAlignFlexStart,
intValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,11 @@ public void setAlignContent(@Nullable String alignContent) {
setAlignContent(YogaAlign.SPACE_AROUND);
return;
}
case "space-evenly":
{
setAlignContent(YogaAlign.SPACE_EVENLY);
return;
}
default:
{
FLog.w(ReactConstants.TAG, "invalid value for alignContent: " + alignContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ inline void fromRawValue(
result = yoga::Align::SpaceAround;
return;
}
if (stringValue == "space-evenly") {
result = yoga::Align::SpaceEvenly;
return;
}
LOG(ERROR) << "Could not parse yoga::Align:" << stringValue;
react_native_expect(false);
}
Expand Down

0 comments on commit 68ea9e7

Please sign in to comment.