Skip to content

Commit

Permalink
Bindings for alignContent: "space-evenly" (#41020)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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: 44df3b8ddc7171cddf56957c11ac7d975f706f9d
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 18, 2023
1 parent 9a03e99 commit c9d0a00
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
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
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
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
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
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 c9d0a00

Please sign in to comment.