Skip to content

Commit

Permalink
Bindings for alignContent: "space-evenly" (facebook#41020)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#41020

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: 2f4d33ffc7411a04bc3f9ed4b345b01489810bc0
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 17, 2023
1 parent 8407850 commit a493bed
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 a493bed

Please sign in to comment.