mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Introducing YGPositionTypeStatic
Summary: Changelog: [Internal] Fabric-specific internal change. This diff introduces a new value for `YGPositionType`: `YGPositionTypeStatic`. No part of Yoga, RN, Litho or CK uses this value yet. `relative` and `static` values behave the same way for now. We also do not change any defaults. So, it should be fine. Reviewed By: SidharthGuglani Differential Revision: D22386732 fbshipit-source-id: 39cd9e818458ac2a91efb175f24a74c8c303ff08
This commit is contained in:
committed by
Facebook GitHub Bot
parent
123423c2a9
commit
ec60ebe792
@@ -1119,7 +1119,11 @@ RCT_ENUM_CONVERTER(
|
||||
|
||||
RCT_ENUM_CONVERTER(
|
||||
YGPositionType,
|
||||
(@{@"absolute" : @(YGPositionTypeAbsolute), @"relative" : @(YGPositionTypeRelative)}),
|
||||
(@{
|
||||
@"static" : @(YGPositionTypeStatic),
|
||||
@"absolute" : @(YGPositionTypeAbsolute),
|
||||
@"relative" : @(YGPositionTypeRelative)
|
||||
}),
|
||||
YGPositionTypeRelative,
|
||||
intValue)
|
||||
|
||||
|
||||
@@ -779,6 +779,11 @@ public class LayoutShadowNode extends ReactShadowNodeImpl {
|
||||
}
|
||||
|
||||
switch (position) {
|
||||
case "static":
|
||||
{
|
||||
setPositionType(YogaPositionType.STATIC);
|
||||
break;
|
||||
}
|
||||
case "relative":
|
||||
{
|
||||
setPositionType(YogaPositionType.RELATIVE);
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
package com.facebook.yoga;
|
||||
|
||||
public enum YogaPositionType {
|
||||
RELATIVE(0),
|
||||
ABSOLUTE(1);
|
||||
STATIC(0),
|
||||
RELATIVE(1),
|
||||
ABSOLUTE(2);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
@@ -23,8 +24,9 @@ public enum YogaPositionType {
|
||||
|
||||
public static YogaPositionType fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return RELATIVE;
|
||||
case 1: return ABSOLUTE;
|
||||
case 0: return STATIC;
|
||||
case 1: return RELATIVE;
|
||||
case 2: return ABSOLUTE;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,6 +276,10 @@ inline void fromRawValue(const RawValue &value, YGAlign &result) {
|
||||
inline void fromRawValue(const RawValue &value, YGPositionType &result) {
|
||||
assert(value.hasType<std::string>());
|
||||
auto stringValue = (std::string)value;
|
||||
if (stringValue == "static") {
|
||||
result = YGPositionTypeStatic;
|
||||
return;
|
||||
}
|
||||
if (stringValue == "relative") {
|
||||
result = YGPositionTypeRelative;
|
||||
return;
|
||||
@@ -615,6 +619,8 @@ inline std::string toString(const YGAlign &value) {
|
||||
|
||||
inline std::string toString(const YGPositionType &value) {
|
||||
switch (value) {
|
||||
case YGPositionTypeStatic:
|
||||
return "static";
|
||||
case YGPositionTypeRelative:
|
||||
return "relative";
|
||||
case YGPositionTypeAbsolute:
|
||||
|
||||
@@ -179,6 +179,8 @@ const char* YGOverflowToString(const YGOverflow value) {
|
||||
|
||||
const char* YGPositionTypeToString(const YGPositionType value) {
|
||||
switch (value) {
|
||||
case YGPositionTypeStatic:
|
||||
return "static";
|
||||
case YGPositionTypeRelative:
|
||||
return "relative";
|
||||
case YGPositionTypeAbsolute:
|
||||
|
||||
@@ -128,7 +128,11 @@ YG_ENUM_SEQ_DECL(
|
||||
YGOverflowHidden,
|
||||
YGOverflowScroll)
|
||||
|
||||
YG_ENUM_SEQ_DECL(YGPositionType, YGPositionTypeRelative, YGPositionTypeAbsolute)
|
||||
YG_ENUM_SEQ_DECL(
|
||||
YGPositionType,
|
||||
YGPositionTypeStatic,
|
||||
YGPositionTypeRelative,
|
||||
YGPositionTypeAbsolute)
|
||||
|
||||
YG_ENUM_DECL(
|
||||
YGPrintOptions,
|
||||
|
||||
Reference in New Issue
Block a user