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"`

Reviewed By: yungsters

Differential Revision: D50347978

fbshipit-source-id: b773ca19e1db82b8b381bbb984bb844042dcfc3f
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 17, 2023
1 parent c2535e0 commit 4e0dfe8
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 4e0dfe8

Please sign in to comment.