-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This adds the YGGutter enum, used to choose between row/column gap variants (row-gap, column-gap, gap). This used later in changes from #1116, in the APIs which deal with setting gap on style on yoga node. Note the original PR called this `YGGap`, but this ending up leading to a couple public method signatures that could appear ambiguous: 1. `SetGap(YGGap gap, float gapLength)`: Enums like `YGAlign` are the vaues for an `align` prop. `YGGap` controls the variant of the gap (like `YGEdge` does for left/right/top/bottom variants). So the enum reads as if it is the `gapValue`, and it looks like we have two of the same parameter. 2. `SetGap(YGGap gapDirection, float gap)`: This is misleading, because the direction gaps flow is the cross-axis of flex-direction. 3. `GetGap(YGGap gap)`: `gap` is the variant, but looks like an out param. The [CSS Box Alignment](https://www.w3.org/TR/css-align-3/#column-row-gap) spec refers to these gaps as "Gutters", which removes the ambiguity. Changelog: [General][Added] - Add YGGutter Enum Reviewed By: yungsters Differential Revision: D39922412 fbshipit-source-id: 4b0baf800fecb3d03560a4267c7fb4c4330fd39e
- Loading branch information
1 parent
5a18ccd
commit 206bf41
Showing
6 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @generated by enums.py | ||
|
||
namespace Facebook.Yoga | ||
{ | ||
public enum YogaGutter | ||
{ | ||
Column, | ||
Row, | ||
All, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @generated by enums.py | ||
|
||
package com.facebook.yoga; | ||
|
||
public enum YogaGutter { | ||
COLUMN(0), | ||
ROW(1), | ||
ALL(2); | ||
|
||
private final int mIntValue; | ||
|
||
YogaGutter(int intValue) { | ||
mIntValue = intValue; | ||
} | ||
|
||
public int intValue() { | ||
return mIntValue; | ||
} | ||
|
||
public static YogaGutter fromInt(int value) { | ||
switch (value) { | ||
case 0: return COLUMN; | ||
case 1: return ROW; | ||
case 2: return ALL; | ||
default: throw new IllegalArgumentException("Unknown enum value: " + value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters