mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-11 10:38:00 +08:00
Rename enums
Differential Revision: D4244360 fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001
This commit is contained in:
committed by
Facebook Github Bot
parent
476973e789
commit
779508c0ba
@@ -13,10 +13,10 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
/**
|
||||
* Inteface for recieving logs from native layer. Use by setting CSSNode.setLogger(myLogger);
|
||||
* See CSSLogLevel for the different log levels.
|
||||
* See YogaLogLevel for the different log levels.
|
||||
*/
|
||||
@DoNotStrip
|
||||
public interface CSSLogger {
|
||||
@DoNotStrip
|
||||
void log(CSSLogLevel level, String message);
|
||||
void log(YogaLogLevel level, String message);
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
int feature,
|
||||
boolean enabled);
|
||||
public static void setExperimentalFeatureEnabled(
|
||||
CSSExperimentalFeature feature,
|
||||
YogaExperimentalFeature feature,
|
||||
boolean enabled) {
|
||||
jni_CSSLayoutSetExperimentalFeatureEnabled(feature.intValue(), enabled);
|
||||
}
|
||||
|
||||
private static native boolean jni_CSSLayoutIsExperimentalFeatureEnabled(int feature);
|
||||
public static boolean isExperimentalFeatureEnabled(CSSExperimentalFeature feature) {
|
||||
public static boolean isExperimentalFeatureEnabled(YogaExperimentalFeature feature) {
|
||||
return jni_CSSLayoutIsExperimentalFeatureEnabled(feature.intValue());
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
private boolean mHasSetPosition = false;
|
||||
|
||||
@DoNotStrip
|
||||
private float mWidth = CSSConstants.UNDEFINED;
|
||||
private float mWidth = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mHeight = CSSConstants.UNDEFINED;
|
||||
private float mHeight = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mTop = CSSConstants.UNDEFINED;
|
||||
private float mTop = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mLeft = CSSConstants.UNDEFINED;
|
||||
private float mLeft = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private int mLayoutDirection = 0;
|
||||
|
||||
@@ -97,10 +97,10 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
mHasSetBorder = false;
|
||||
mHasSetPosition = false;
|
||||
|
||||
mWidth = CSSConstants.UNDEFINED;
|
||||
mHeight = CSSConstants.UNDEFINED;
|
||||
mTop = CSSConstants.UNDEFINED;
|
||||
mLeft = CSSConstants.UNDEFINED;
|
||||
mWidth = YogaConstants.UNDEFINED;
|
||||
mHeight = YogaConstants.UNDEFINED;
|
||||
mTop = YogaConstants.UNDEFINED;
|
||||
mLeft = YogaConstants.UNDEFINED;
|
||||
mLayoutDirection = 0;
|
||||
|
||||
mMeasureFunction = null;
|
||||
@@ -193,103 +193,103 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
|
||||
private native int jni_CSSNodeStyleGetDirection(long nativePointer);
|
||||
@Override
|
||||
public CSSDirection getStyleDirection() {
|
||||
return CSSDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)];
|
||||
public YogaDirection getStyleDirection() {
|
||||
return YogaDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction);
|
||||
@Override
|
||||
public void setDirection(CSSDirection direction) {
|
||||
public void setDirection(YogaDirection direction) {
|
||||
jni_CSSNodeStyleSetDirection(mNativePointer, direction.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer);
|
||||
@Override
|
||||
public CSSFlexDirection getFlexDirection() {
|
||||
return CSSFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)];
|
||||
public YogaFlexDirection getFlexDirection() {
|
||||
return YogaFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
||||
@Override
|
||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
||||
jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer);
|
||||
@Override
|
||||
public CSSJustify getJustifyContent() {
|
||||
return CSSJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)];
|
||||
public YogaJustify getJustifyContent() {
|
||||
return YogaJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
||||
@Override
|
||||
public void setJustifyContent(CSSJustify justifyContent) {
|
||||
public void setJustifyContent(YogaJustify justifyContent) {
|
||||
jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetAlignItems(long nativePointer);
|
||||
@Override
|
||||
public CSSAlign getAlignItems() {
|
||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)];
|
||||
public YogaAlign getAlignItems() {
|
||||
return YogaAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
||||
@Override
|
||||
public void setAlignItems(CSSAlign alignItems) {
|
||||
public void setAlignItems(YogaAlign alignItems) {
|
||||
jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer);
|
||||
@Override
|
||||
public CSSAlign getAlignSelf() {
|
||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)];
|
||||
public YogaAlign getAlignSelf() {
|
||||
return YogaAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
||||
@Override
|
||||
public void setAlignSelf(CSSAlign alignSelf) {
|
||||
public void setAlignSelf(YogaAlign alignSelf) {
|
||||
jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetAlignContent(long nativePointer);
|
||||
@Override
|
||||
public CSSAlign getAlignContent() {
|
||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)];
|
||||
public YogaAlign getAlignContent() {
|
||||
return YogaAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
||||
@Override
|
||||
public void setAlignContent(CSSAlign alignContent) {
|
||||
public void setAlignContent(YogaAlign alignContent) {
|
||||
jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetPositionType(long nativePointer);
|
||||
@Override
|
||||
public CSSPositionType getPositionType() {
|
||||
return CSSPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)];
|
||||
public YogaPositionType getPositionType() {
|
||||
return YogaPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType);
|
||||
@Override
|
||||
public void setPositionType(CSSPositionType positionType) {
|
||||
public void setPositionType(YogaPositionType positionType) {
|
||||
jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
||||
@Override
|
||||
public void setWrap(CSSWrap flexWrap) {
|
||||
public void setWrap(YogaWrap flexWrap) {
|
||||
jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetOverflow(long nativePointer);
|
||||
@Override
|
||||
public CSSOverflow getOverflow() {
|
||||
return CSSOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)];
|
||||
public YogaOverflow getOverflow() {
|
||||
return YogaOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow);
|
||||
@Override
|
||||
public void setOverflow(CSSOverflow overflow) {
|
||||
public void setOverflow(YogaOverflow overflow) {
|
||||
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
||||
}
|
||||
|
||||
@@ -337,64 +337,64 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
|
||||
private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getMargin(CSSEdge edge) {
|
||||
public float getMargin(YogaEdge edge) {
|
||||
if (!mHasSetMargin) {
|
||||
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||
return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetMargin(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||
@Override
|
||||
public void setMargin(CSSEdge edge, float margin) {
|
||||
public void setMargin(YogaEdge edge, float margin) {
|
||||
mHasSetMargin = true;
|
||||
jni_CSSNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getPadding(CSSEdge edge) {
|
||||
public float getPadding(YogaEdge edge) {
|
||||
if (!mHasSetPadding) {
|
||||
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||
return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetPadding(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||
@Override
|
||||
public void setPadding(CSSEdge edge, float padding) {
|
||||
public void setPadding(YogaEdge edge, float padding) {
|
||||
mHasSetPadding = true;
|
||||
jni_CSSNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getBorder(CSSEdge edge) {
|
||||
public float getBorder(YogaEdge edge) {
|
||||
if (!mHasSetBorder) {
|
||||
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||
return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetBorder(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border);
|
||||
@Override
|
||||
public void setBorder(CSSEdge edge, float border) {
|
||||
public void setBorder(YogaEdge edge, float border) {
|
||||
mHasSetBorder = true;
|
||||
jni_CSSNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getPosition(CSSEdge edge) {
|
||||
public float getPosition(YogaEdge edge) {
|
||||
if (!mHasSetPosition) {
|
||||
return CSSConstants.UNDEFINED;
|
||||
return YogaConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetPosition(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||
@Override
|
||||
public void setPosition(CSSEdge edge, float position) {
|
||||
public void setPosition(YogaEdge edge, float position) {
|
||||
mHasSetPosition = true;
|
||||
jni_CSSNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
||||
}
|
||||
@@ -502,8 +502,8 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CSSDirection getLayoutDirection() {
|
||||
return CSSDirection.values()[mLayoutDirection];
|
||||
public YogaDirection getLayoutDirection() {
|
||||
return YogaDirection.values()[mLayoutDirection];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
@@ -527,9 +527,9 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
return mMeasureFunction.measure(
|
||||
this,
|
||||
width,
|
||||
CSSMeasureMode.values()[widthMode],
|
||||
YogaMeasureMode.values()[widthMode],
|
||||
height,
|
||||
CSSMeasureMode.values()[heightMode]);
|
||||
YogaMeasureMode.values()[heightMode]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,9 +18,9 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
||||
long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode);
|
||||
YogaMeasureMode heightMode);
|
||||
}
|
||||
|
||||
int getChildCount();
|
||||
@@ -37,21 +37,21 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
||||
void dirty();
|
||||
void markLayoutSeen();
|
||||
void copyStyle(CSSNodeType srcNode);
|
||||
CSSDirection getStyleDirection();
|
||||
void setDirection(CSSDirection direction);
|
||||
CSSFlexDirection getFlexDirection();
|
||||
void setFlexDirection(CSSFlexDirection flexDirection);
|
||||
CSSJustify getJustifyContent();
|
||||
void setJustifyContent(CSSJustify justifyContent);
|
||||
CSSAlign getAlignItems();
|
||||
void setAlignItems(CSSAlign alignItems);
|
||||
CSSAlign getAlignSelf();
|
||||
void setAlignSelf(CSSAlign alignSelf);
|
||||
CSSAlign getAlignContent();
|
||||
void setAlignContent(CSSAlign alignContent);
|
||||
CSSPositionType getPositionType();
|
||||
void setPositionType(CSSPositionType positionType);
|
||||
void setWrap(CSSWrap flexWrap);
|
||||
YogaDirection getStyleDirection();
|
||||
void setDirection(YogaDirection direction);
|
||||
YogaFlexDirection getFlexDirection();
|
||||
void setFlexDirection(YogaFlexDirection flexDirection);
|
||||
YogaJustify getJustifyContent();
|
||||
void setJustifyContent(YogaJustify justifyContent);
|
||||
YogaAlign getAlignItems();
|
||||
void setAlignItems(YogaAlign alignItems);
|
||||
YogaAlign getAlignSelf();
|
||||
void setAlignSelf(YogaAlign alignSelf);
|
||||
YogaAlign getAlignContent();
|
||||
void setAlignContent(YogaAlign alignContent);
|
||||
YogaPositionType getPositionType();
|
||||
void setPositionType(YogaPositionType positionType);
|
||||
void setWrap(YogaWrap flexWrap);
|
||||
void setFlex(float flex);
|
||||
float getFlexGrow();
|
||||
void setFlexGrow(float flexGrow);
|
||||
@@ -59,14 +59,14 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
||||
void setFlexShrink(float flexShrink);
|
||||
float getFlexBasis();
|
||||
void setFlexBasis(float flexBasis);
|
||||
float getMargin(CSSEdge edge);
|
||||
void setMargin(CSSEdge edge, float margin);
|
||||
float getPadding(CSSEdge edge);
|
||||
void setPadding(CSSEdge edge, float padding);
|
||||
float getBorder(CSSEdge edge);
|
||||
void setBorder(CSSEdge edge, float border);
|
||||
float getPosition(CSSEdge edge);
|
||||
void setPosition(CSSEdge edge, float position);
|
||||
float getMargin(YogaEdge edge);
|
||||
void setMargin(YogaEdge edge, float margin);
|
||||
float getPadding(YogaEdge edge);
|
||||
void setPadding(YogaEdge edge, float padding);
|
||||
float getBorder(YogaEdge edge);
|
||||
void setBorder(YogaEdge edge, float border);
|
||||
float getPosition(YogaEdge edge);
|
||||
void setPosition(YogaEdge edge, float position);
|
||||
float getWidth();
|
||||
void setWidth(float width);
|
||||
float getHeight();
|
||||
@@ -83,9 +83,9 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
||||
float getLayoutY();
|
||||
float getLayoutWidth();
|
||||
float getLayoutHeight();
|
||||
CSSDirection getLayoutDirection();
|
||||
CSSOverflow getOverflow();
|
||||
void setOverflow(CSSOverflow overflow);
|
||||
YogaDirection getLayoutDirection();
|
||||
YogaOverflow getOverflow();
|
||||
void setOverflow(YogaOverflow overflow);
|
||||
void setData(Object data);
|
||||
Object getData();
|
||||
void reset();
|
||||
|
||||
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSAlign {
|
||||
public enum YogaAlign {
|
||||
AUTO(0),
|
||||
FLEX_START(1),
|
||||
CENTER(2),
|
||||
@@ -21,7 +21,7 @@ public enum CSSAlign {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSAlign(int intValue) {
|
||||
YogaAlign(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum CSSAlign {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSAlign fromInt(int value) {
|
||||
public static YogaAlign fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return AUTO;
|
||||
case 1: return FLEX_START;
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
package com.facebook.csslayout;
|
||||
|
||||
public class CSSConstants {
|
||||
public class YogaConstants {
|
||||
|
||||
public static final float UNDEFINED = Float.NaN;
|
||||
|
||||
@@ -12,13 +12,13 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSDimension {
|
||||
public enum YogaDimension {
|
||||
WIDTH(0),
|
||||
HEIGHT(1);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSDimension(int intValue) {
|
||||
YogaDimension(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum CSSDimension {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSDimension fromInt(int value) {
|
||||
public static YogaDimension fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return WIDTH;
|
||||
case 1: return HEIGHT;
|
||||
@@ -12,14 +12,14 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSDirection {
|
||||
public enum YogaDirection {
|
||||
INHERIT(0),
|
||||
LTR(1),
|
||||
RTL(2);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSDirection(int intValue) {
|
||||
YogaDirection(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum CSSDirection {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSDirection fromInt(int value) {
|
||||
public static YogaDirection fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return INHERIT;
|
||||
case 1: return LTR;
|
||||
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSEdge {
|
||||
public enum YogaEdge {
|
||||
LEFT(0),
|
||||
TOP(1),
|
||||
RIGHT(2),
|
||||
@@ -25,7 +25,7 @@ public enum CSSEdge {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSEdge(int intValue) {
|
||||
YogaEdge(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public enum CSSEdge {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSEdge fromInt(int value) {
|
||||
public static YogaEdge fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return LEFT;
|
||||
case 1: return TOP;
|
||||
@@ -12,13 +12,13 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSExperimentalFeature {
|
||||
public enum YogaExperimentalFeature {
|
||||
ROUNDING(0),
|
||||
WEB_FLEX_BASIS(1);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSExperimentalFeature(int intValue) {
|
||||
YogaExperimentalFeature(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum CSSExperimentalFeature {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSExperimentalFeature fromInt(int value) {
|
||||
public static YogaExperimentalFeature fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return ROUNDING;
|
||||
case 1: return WEB_FLEX_BASIS;
|
||||
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSFlexDirection {
|
||||
public enum YogaFlexDirection {
|
||||
COLUMN(0),
|
||||
COLUMN_REVERSE(1),
|
||||
ROW(2),
|
||||
@@ -20,7 +20,7 @@ public enum CSSFlexDirection {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSFlexDirection(int intValue) {
|
||||
YogaFlexDirection(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum CSSFlexDirection {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSFlexDirection fromInt(int value) {
|
||||
public static YogaFlexDirection fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return COLUMN;
|
||||
case 1: return COLUMN_REVERSE;
|
||||
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSJustify {
|
||||
public enum YogaJustify {
|
||||
FLEX_START(0),
|
||||
CENTER(1),
|
||||
FLEX_END(2),
|
||||
@@ -21,7 +21,7 @@ public enum CSSJustify {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSJustify(int intValue) {
|
||||
YogaJustify(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum CSSJustify {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSJustify fromInt(int value) {
|
||||
public static YogaJustify fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return FLEX_START;
|
||||
case 1: return CENTER;
|
||||
@@ -12,7 +12,7 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSLogLevel {
|
||||
public enum YogaLogLevel {
|
||||
ERROR(0),
|
||||
WARN(1),
|
||||
INFO(2),
|
||||
@@ -21,7 +21,7 @@ public enum CSSLogLevel {
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSLogLevel(int intValue) {
|
||||
YogaLogLevel(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum CSSLogLevel {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSLogLevel fromInt(int value) {
|
||||
public static YogaLogLevel fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return ERROR;
|
||||
case 1: return WARN;
|
||||
@@ -12,14 +12,14 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSMeasureMode {
|
||||
public enum YogaMeasureMode {
|
||||
UNDEFINED(0),
|
||||
EXACTLY(1),
|
||||
AT_MOST(2);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSMeasureMode(int intValue) {
|
||||
YogaMeasureMode(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum CSSMeasureMode {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSMeasureMode fromInt(int value) {
|
||||
public static YogaMeasureMode fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return UNDEFINED;
|
||||
case 1: return EXACTLY;
|
||||
@@ -12,14 +12,14 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSOverflow {
|
||||
public enum YogaOverflow {
|
||||
VISIBLE(0),
|
||||
HIDDEN(1),
|
||||
SCROLL(2);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSOverflow(int intValue) {
|
||||
YogaOverflow(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum CSSOverflow {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSOverflow fromInt(int value) {
|
||||
public static YogaOverflow fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return VISIBLE;
|
||||
case 1: return HIDDEN;
|
||||
@@ -12,13 +12,13 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSPositionType {
|
||||
public enum YogaPositionType {
|
||||
RELATIVE(0),
|
||||
ABSOLUTE(1);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSPositionType(int intValue) {
|
||||
YogaPositionType(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum CSSPositionType {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSPositionType fromInt(int value) {
|
||||
public static YogaPositionType fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return RELATIVE;
|
||||
case 1: return ABSOLUTE;
|
||||
@@ -12,14 +12,14 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSPrintOptions {
|
||||
public enum YogaPrintOptions {
|
||||
LAYOUT(1),
|
||||
STYLE(2),
|
||||
CHILDREN(4);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSPrintOptions(int intValue) {
|
||||
YogaPrintOptions(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public enum CSSPrintOptions {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSPrintOptions fromInt(int value) {
|
||||
public static YogaPrintOptions fromInt(int value) {
|
||||
switch (value) {
|
||||
case 1: return LAYOUT;
|
||||
case 2: return STYLE;
|
||||
@@ -12,13 +12,13 @@ package com.facebook.csslayout;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum CSSWrap {
|
||||
public enum YogaWrap {
|
||||
NO_WRAP(0),
|
||||
WRAP(1);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
CSSWrap(int intValue) {
|
||||
YogaWrap(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum CSSWrap {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static CSSWrap fromInt(int value) {
|
||||
public static YogaWrap fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return NO_WRAP;
|
||||
case 1: return WRAP;
|
||||
@@ -6,13 +6,13 @@ import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.facebook.csslayout.CSSAlign;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.CSSFlexDirection;
|
||||
import com.facebook.csslayout.CSSJustify;
|
||||
import com.facebook.csslayout.CSSOverflow;
|
||||
import com.facebook.csslayout.CSSPositionType;
|
||||
import com.facebook.csslayout.CSSWrap;
|
||||
import com.facebook.csslayout.YogaAlign;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.csslayout.YogaFlexDirection;
|
||||
import com.facebook.csslayout.YogaJustify;
|
||||
import com.facebook.csslayout.YogaOverflow;
|
||||
import com.facebook.csslayout.YogaPositionType;
|
||||
import com.facebook.csslayout.YogaWrap;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
|
||||
@@ -27,57 +27,57 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
*/
|
||||
public class LayoutShadowNode extends ReactShadowNode {
|
||||
|
||||
@ReactProp(name = ViewProps.WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.WIDTH, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setWidth(float width) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleWidth(CSSConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
|
||||
setStyleWidth(YogaConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMinWidth(float minWidth) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMinWidth(
|
||||
CSSConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(minWidth));
|
||||
YogaConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(minWidth));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MAX_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MAX_WIDTH, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMaxWidth(float maxWidth) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMaxWidth(
|
||||
CSSConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
|
||||
YogaConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setHeight(float height) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleHeight(
|
||||
CSSConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
|
||||
YogaConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MIN_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MIN_HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMinHeight(float minHeight) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMinHeight(
|
||||
CSSConstants.isUndefined(minHeight) ? minHeight : PixelUtil.toPixelFromDIP(minHeight));
|
||||
YogaConstants.isUndefined(minHeight) ? minHeight : PixelUtil.toPixelFromDIP(minHeight));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MAX_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MAX_HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMaxHeight(float maxHeight) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMaxHeight(
|
||||
CSSConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
|
||||
YogaConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.FLEX, defaultFloat = 0f)
|
||||
@@ -112,7 +112,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
super.setFlexBasis(flexBasis);
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setAspectRatio(float aspectRatio) {
|
||||
setStyleAspectRatio(aspectRatio);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
return;
|
||||
}
|
||||
setFlexDirection(
|
||||
flexDirection == null ? CSSFlexDirection.COLUMN : CSSFlexDirection.valueOf(
|
||||
flexDirection == null ? YogaFlexDirection.COLUMN : YogaFlexDirection.valueOf(
|
||||
flexDirection.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -133,9 +133,9 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
return;
|
||||
}
|
||||
if (flexWrap == null || flexWrap.equals("nowrap")) {
|
||||
setFlexWrap(CSSWrap.NO_WRAP);
|
||||
setFlexWrap(YogaWrap.NO_WRAP);
|
||||
} else if (flexWrap.equals("wrap")) {
|
||||
setFlexWrap(CSSWrap.WRAP);
|
||||
setFlexWrap(YogaWrap.WRAP);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown flexWrap value: " + flexWrap);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setAlignSelf(alignSelf == null ? CSSAlign.AUTO : CSSAlign.valueOf(
|
||||
setAlignSelf(alignSelf == null ? YogaAlign.AUTO : YogaAlign.valueOf(
|
||||
alignSelf.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
return;
|
||||
}
|
||||
setAlignItems(
|
||||
alignItems == null ? CSSAlign.STRETCH : CSSAlign.valueOf(
|
||||
alignItems == null ? YogaAlign.STRETCH : YogaAlign.valueOf(
|
||||
alignItems.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setJustifyContent(justifyContent == null ? CSSJustify.FLEX_START : CSSJustify.valueOf(
|
||||
setJustifyContent(justifyContent == null ? YogaJustify.FLEX_START : YogaJustify.valueOf(
|
||||
justifyContent.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setOverflow(overflow == null ? CSSOverflow.VISIBLE : CSSOverflow.valueOf(
|
||||
setOverflow(overflow == null ? YogaOverflow.VISIBLE : YogaOverflow.valueOf(
|
||||
overflow.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.MARGIN_RIGHT,
|
||||
ViewProps.MARGIN_TOP,
|
||||
ViewProps.MARGIN_BOTTOM,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMargins(int index, float margin) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
@@ -202,14 +202,14 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.PADDING_RIGHT,
|
||||
ViewProps.PADDING_TOP,
|
||||
ViewProps.PADDING_BOTTOM,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setPaddings(int index, float padding) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setPadding(
|
||||
ViewProps.PADDING_MARGIN_SPACING_TYPES[index],
|
||||
CSSConstants.isUndefined(padding) ? padding : PixelUtil.toPixelFromDIP(padding));
|
||||
YogaConstants.isUndefined(padding) ? padding : PixelUtil.toPixelFromDIP(padding));
|
||||
}
|
||||
|
||||
@ReactPropGroup(names = {
|
||||
@@ -218,7 +218,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.BORDER_RIGHT_WIDTH,
|
||||
ViewProps.BORDER_TOP_WIDTH,
|
||||
ViewProps.BORDER_BOTTOM_WIDTH,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderWidths(int index, float borderWidth) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
@@ -231,14 +231,14 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.RIGHT,
|
||||
ViewProps.TOP,
|
||||
ViewProps.BOTTOM,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setPositionValues(int index, float position) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setPosition(
|
||||
ViewProps.POSITION_SPACING_TYPES[index],
|
||||
CSSConstants.isUndefined(position) ? position : PixelUtil.toPixelFromDIP(position));
|
||||
YogaConstants.isUndefined(position) ? position : PixelUtil.toPixelFromDIP(position));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.POSITION)
|
||||
@@ -246,8 +246,8 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
CSSPositionType positionType = position == null ?
|
||||
CSSPositionType.RELATIVE : CSSPositionType.valueOf(position.toUpperCase(Locale.US));
|
||||
YogaPositionType positionType = position == null ?
|
||||
YogaPositionType.RELATIVE : YogaPositionType.valueOf(position.toUpperCase(Locale.US));
|
||||
setPositionType(positionType);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,17 +13,17 @@ import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.facebook.csslayout.CSSAlign;
|
||||
import com.facebook.csslayout.CSSEdge;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.csslayout.CSSFlexDirection;
|
||||
import com.facebook.csslayout.CSSJustify;
|
||||
import com.facebook.csslayout.YogaAlign;
|
||||
import com.facebook.csslayout.YogaEdge;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.csslayout.YogaDirection;
|
||||
import com.facebook.csslayout.YogaFlexDirection;
|
||||
import com.facebook.csslayout.YogaJustify;
|
||||
import com.facebook.csslayout.CSSNode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.CSSOverflow;
|
||||
import com.facebook.csslayout.CSSPositionType;
|
||||
import com.facebook.csslayout.CSSWrap;
|
||||
import com.facebook.csslayout.YogaOverflow;
|
||||
import com.facebook.csslayout.YogaPositionType;
|
||||
import com.facebook.csslayout.YogaWrap;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ReactShadowNode {
|
||||
private float mAbsoluteRight;
|
||||
private float mAbsoluteBottom;
|
||||
private final Spacing mDefaultPadding = new Spacing(0);
|
||||
private final Spacing mPadding = new Spacing(CSSConstants.UNDEFINED);
|
||||
private final Spacing mPadding = new Spacing(YogaConstants.UNDEFINED);
|
||||
private final CSSNode mCSSNode;
|
||||
|
||||
public ReactShadowNode() {
|
||||
@@ -506,11 +506,11 @@ public class ReactShadowNode {
|
||||
return Math.round(mAbsoluteBottom - mAbsoluteTop);
|
||||
}
|
||||
|
||||
public final CSSDirection getLayoutDirection() {
|
||||
public final YogaDirection getLayoutDirection() {
|
||||
return mCSSNode.getLayoutDirection();
|
||||
}
|
||||
|
||||
public void setLayoutDirection(CSSDirection direction) {
|
||||
public void setLayoutDirection(YogaDirection direction) {
|
||||
mCSSNode.setDirection(direction);
|
||||
}
|
||||
|
||||
@@ -566,36 +566,36 @@ public class ReactShadowNode {
|
||||
mCSSNode.setAspectRatio(aspectRatio);
|
||||
}
|
||||
|
||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
||||
mCSSNode.setFlexDirection(flexDirection);
|
||||
}
|
||||
|
||||
public void setFlexWrap(CSSWrap wrap) {
|
||||
public void setFlexWrap(YogaWrap wrap) {
|
||||
mCSSNode.setWrap(wrap);
|
||||
}
|
||||
|
||||
public void setAlignSelf(CSSAlign alignSelf) {
|
||||
public void setAlignSelf(YogaAlign alignSelf) {
|
||||
mCSSNode.setAlignSelf(alignSelf);
|
||||
}
|
||||
|
||||
public void setAlignItems(CSSAlign alignItems) {
|
||||
public void setAlignItems(YogaAlign alignItems) {
|
||||
mCSSNode.setAlignItems(alignItems);
|
||||
}
|
||||
|
||||
public void setJustifyContent(CSSJustify justifyContent) {
|
||||
public void setJustifyContent(YogaJustify justifyContent) {
|
||||
mCSSNode.setJustifyContent(justifyContent);
|
||||
}
|
||||
|
||||
public void setOverflow(CSSOverflow overflow) {
|
||||
public void setOverflow(YogaOverflow overflow) {
|
||||
mCSSNode.setOverflow(overflow);
|
||||
}
|
||||
|
||||
public void setMargin(int spacingType, float margin) {
|
||||
mCSSNode.setMargin(CSSEdge.fromInt(spacingType), margin);
|
||||
mCSSNode.setMargin(YogaEdge.fromInt(spacingType), margin);
|
||||
}
|
||||
|
||||
public final float getPadding(int spacingType) {
|
||||
return mCSSNode.getPadding(CSSEdge.fromInt(spacingType));
|
||||
return mCSSNode.getPadding(YogaEdge.fromInt(spacingType));
|
||||
}
|
||||
|
||||
public void setDefaultPadding(int spacingType, float padding) {
|
||||
@@ -614,40 +614,40 @@ public class ReactShadowNode {
|
||||
spacingType == Spacing.RIGHT ||
|
||||
spacingType == Spacing.START ||
|
||||
spacingType == Spacing.END) {
|
||||
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.HORIZONTAL)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.HORIZONTAL)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
} else {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
}
|
||||
} else if (spacingType == Spacing.TOP || spacingType == Spacing.BOTTOM) {
|
||||
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.VERTICAL)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.VERTICAL)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
} else {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
}
|
||||
} else {
|
||||
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType))) {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType))) {
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
} else {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
mCSSNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBorder(int spacingType, float borderWidth) {
|
||||
mCSSNode.setBorder(CSSEdge.fromInt(spacingType), borderWidth);
|
||||
mCSSNode.setBorder(YogaEdge.fromInt(spacingType), borderWidth);
|
||||
}
|
||||
|
||||
public void setPosition(int spacingType, float position) {
|
||||
mCSSNode.setPosition(CSSEdge.fromInt(spacingType), position);
|
||||
mCSSNode.setPosition(YogaEdge.fromInt(spacingType), position);
|
||||
}
|
||||
|
||||
public void setPositionType(CSSPositionType positionType) {
|
||||
public void setPositionType(YogaPositionType positionType) {
|
||||
mCSSNode.setPositionType(positionType);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -96,7 +96,7 @@ public class Spacing {
|
||||
if (!FloatUtil.floatsEqual(mSpacing[spacingType], value)) {
|
||||
mSpacing[spacingType] = value;
|
||||
|
||||
if (CSSConstants.isUndefined(value)) {
|
||||
if (YogaConstants.isUndefined(value)) {
|
||||
mValueFlags &= ~sFlagsMap[spacingType];
|
||||
} else {
|
||||
mValueFlags |= sFlagsMap[spacingType];
|
||||
@@ -120,7 +120,7 @@ public class Spacing {
|
||||
*/
|
||||
public float get(int spacingType) {
|
||||
float defaultValue = (spacingType == START || spacingType == END
|
||||
? CSSConstants.UNDEFINED
|
||||
? YogaConstants.UNDEFINED
|
||||
: mDefaultValue);
|
||||
|
||||
if (mValueFlags == 0) {
|
||||
@@ -159,7 +159,7 @@ public class Spacing {
|
||||
* recycling {@link Spacing} instances.
|
||||
*/
|
||||
public void reset() {
|
||||
Arrays.fill(mSpacing, CSSConstants.UNDEFINED);
|
||||
Arrays.fill(mSpacing, YogaConstants.UNDEFINED);
|
||||
mHasAliasesSet = false;
|
||||
mValueFlags = 0;
|
||||
}
|
||||
@@ -178,15 +178,15 @@ public class Spacing {
|
||||
|
||||
private static float[] newFullSpacingArray() {
|
||||
return new float[] {
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.csslayout.YogaDirection;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.animation.Animation;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
@@ -84,7 +84,7 @@ public class UIImplementation {
|
||||
ReactShadowNode rootCSSNode = new ReactShadowNode();
|
||||
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
|
||||
if (sharedI18nUtilInstance.isRTL(mReactContext)) {
|
||||
rootCSSNode.setLayoutDirection(CSSDirection.RTL);
|
||||
rootCSSNode.setLayoutDirection(YogaDirection.RTL);
|
||||
}
|
||||
rootCSSNode.setViewClassName("Root");
|
||||
return rootCSSNode;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
package com.facebook.react.views.art;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
@@ -31,9 +31,9 @@ public class ARTSurfaceViewManager extends
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
throw new IllegalStateException("SurfaceView should have explicit width and height set");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Map;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
@@ -116,9 +116,9 @@ public class ReactImageManager extends SimpleViewManager<ReactImageView> {
|
||||
ViewProps.BORDER_TOP_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderRadius(ReactImageView view, int index, float borderRadius) {
|
||||
if (!CSSConstants.isUndefined(borderRadius)) {
|
||||
if (!YogaConstants.isUndefined(borderRadius)) {
|
||||
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import com.facebook.common.util.UriUtil;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
|
||||
import com.facebook.drawee.controller.BaseControllerListener;
|
||||
import com.facebook.drawee.controller.ControllerListener;
|
||||
@@ -150,7 +150,7 @@ public class ReactImageView extends GenericDraweeView {
|
||||
private int mBorderColor;
|
||||
private int mOverlayColor;
|
||||
private float mBorderWidth;
|
||||
private float mBorderRadius = CSSConstants.UNDEFINED;
|
||||
private float mBorderRadius = YogaConstants.UNDEFINED;
|
||||
private @Nullable float[] mBorderCornerRadii;
|
||||
private ScalingUtils.ScaleType mScaleType;
|
||||
private boolean mIsDirty;
|
||||
@@ -247,7 +247,7 @@ public class ReactImageView extends GenericDraweeView {
|
||||
public void setBorderRadius(float borderRadius, int position) {
|
||||
if (mBorderCornerRadii == null) {
|
||||
mBorderCornerRadii = new float[4];
|
||||
Arrays.fill(mBorderCornerRadii, CSSConstants.UNDEFINED);
|
||||
Arrays.fill(mBorderCornerRadii, YogaConstants.UNDEFINED);
|
||||
}
|
||||
|
||||
if (!FloatUtil.floatsEqual(mBorderCornerRadii[position], borderRadius)) {
|
||||
@@ -304,12 +304,12 @@ public class ReactImageView extends GenericDraweeView {
|
||||
}
|
||||
|
||||
private void cornerRadii(float[] computedCorners) {
|
||||
float defaultBorderRadius = !CSSConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0;
|
||||
float defaultBorderRadius = !YogaConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0;
|
||||
|
||||
computedCorners[0] = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[0]) ? mBorderCornerRadii[0] : defaultBorderRadius;
|
||||
computedCorners[1] = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[1]) ? mBorderCornerRadii[1] : defaultBorderRadius;
|
||||
computedCorners[2] = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[2]) ? mBorderCornerRadii[2] : defaultBorderRadius;
|
||||
computedCorners[3] = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[3]) ? mBorderCornerRadii[3] : defaultBorderRadius;
|
||||
computedCorners[0] = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[0]) ? mBorderCornerRadii[0] : defaultBorderRadius;
|
||||
computedCorners[1] = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[1]) ? mBorderCornerRadii[1] : defaultBorderRadius;
|
||||
computedCorners[2] = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[2]) ? mBorderCornerRadii[2] : defaultBorderRadius;
|
||||
computedCorners[3] = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[3]) ? mBorderCornerRadii[3] : defaultBorderRadius;
|
||||
}
|
||||
|
||||
public void maybeUpdateView() {
|
||||
|
||||
@@ -19,7 +19,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
@@ -55,9 +55,9 @@ public class ProgressBarShadowNode extends LayoutShadowNode implements CSSNodeAP
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
final int style = ReactProgressBarViewManager.getStyleFromString(getStyle());
|
||||
if (!mMeasured.contains(style)) {
|
||||
ProgressBar progressBar = ReactProgressBarViewManager.createProgressBar(getThemedContext(), style);
|
||||
|
||||
@@ -15,7 +15,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
@@ -53,9 +53,9 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider> {
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
if (!mMeasured) {
|
||||
SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
|
||||
final int spec = View.MeasureSpec.makeMeasureSpec(
|
||||
|
||||
@@ -14,7 +14,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
@@ -47,9 +47,9 @@ public class ReactSwitchManager extends SimpleViewManager<ReactSwitch> {
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
if (!mMeasured) {
|
||||
// Create a switch with the default config and measure it; since we don't (currently)
|
||||
// support setting custom switch text, this is fine, as all switches will measure the same
|
||||
|
||||
@@ -30,9 +30,9 @@ import android.text.style.UnderlineSpan;
|
||||
import android.view.Gravity;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaDirection;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
@@ -224,9 +224,9 @@ public class ReactTextShadowNode extends LayoutShadowNode {
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
// TODO(5578671): Handle text direction (see View#getTextDirectionHeuristic)
|
||||
TextPaint textPaint = sTextPaintInstance;
|
||||
Layout layout;
|
||||
@@ -238,11 +238,11 @@ public class ReactTextShadowNode extends LayoutShadowNode {
|
||||
Layout.getDesiredWidth(text, textPaint) : Float.NaN;
|
||||
|
||||
// technically, width should never be negative, but there is currently a bug in
|
||||
boolean unconstrainedWidth = widthMode == CSSMeasureMode.UNDEFINED || width < 0;
|
||||
boolean unconstrainedWidth = widthMode == YogaMeasureMode.UNDEFINED || width < 0;
|
||||
|
||||
if (boring == null &&
|
||||
(unconstrainedWidth ||
|
||||
(!CSSConstants.isUndefined(desiredWidth) && desiredWidth <= width))) {
|
||||
(!YogaConstants.isUndefined(desiredWidth) && desiredWidth <= width))) {
|
||||
// Is used when the width is not known and the text is not boring, ie. if it contains
|
||||
// unicode characters.
|
||||
layout = new StaticLayout(
|
||||
@@ -369,7 +369,7 @@ public class ReactTextShadowNode extends LayoutShadowNode {
|
||||
// Return text alignment according to LTR or RTL style
|
||||
private int getTextAlign() {
|
||||
int textAlign = mTextAlign;
|
||||
if (getLayoutDirection() == CSSDirection.RTL) {
|
||||
if (getLayoutDirection() == YogaDirection.RTL) {
|
||||
if (textAlign == Gravity.RIGHT) {
|
||||
textAlign = Gravity.LEFT;
|
||||
} else if (textAlign == Gravity.LEFT) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.BaseViewManager;
|
||||
@@ -102,9 +102,9 @@ public class ReactTextViewManager extends BaseViewManager<ReactTextView, ReactTe
|
||||
ViewProps.BORDER_TOP_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderRadius(ReactTextView view, int index, float borderRadius) {
|
||||
if (!CSSConstants.isUndefined(borderRadius)) {
|
||||
if (!YogaConstants.isUndefined(borderRadius)) {
|
||||
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ public class ReactTextViewManager extends BaseViewManager<ReactTextView, ReactTe
|
||||
ViewProps.BORDER_RIGHT_WIDTH,
|
||||
ViewProps.BORDER_TOP_WIDTH,
|
||||
ViewProps.BORDER_BOTTOM_WIDTH,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderWidth(ReactTextView view, int index, float width) {
|
||||
if (!CSSConstants.isUndefined(width)) {
|
||||
if (!YogaConstants.isUndefined(width)) {
|
||||
width = PixelUtil.toPixelFromDIP(width);
|
||||
}
|
||||
view.setBorderWidth(SPACING_TYPES[index], width);
|
||||
@@ -138,8 +138,8 @@ public class ReactTextViewManager extends BaseViewManager<ReactTextView, ReactTe
|
||||
"borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "borderBottomColor"
|
||||
}, customType = "Color")
|
||||
public void setBorderColor(ReactTextView view, int index, Integer color) {
|
||||
float rgbComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
float rgbComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.facebook.common.util.UriUtil;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
@@ -35,8 +35,8 @@ public class FrescoBasedReactTextInlineImageShadowNode extends ReactTextInlineIm
|
||||
private @Nullable Uri mUri;
|
||||
private final AbstractDraweeControllerBuilder mDraweeControllerBuilder;
|
||||
private final @Nullable Object mCallerContext;
|
||||
private float mWidth = CSSConstants.UNDEFINED;
|
||||
private float mHeight = CSSConstants.UNDEFINED;
|
||||
private float mWidth = YogaConstants.UNDEFINED;
|
||||
private float mHeight = YogaConstants.UNDEFINED;
|
||||
|
||||
public FrescoBasedReactTextInlineImageShadowNode(
|
||||
AbstractDraweeControllerBuilder draweeControllerBuilder,
|
||||
|
||||
@@ -28,7 +28,7 @@ import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
@@ -496,9 +496,9 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
ViewProps.BORDER_TOP_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderRadius(ReactEditText view, int index, float borderRadius) {
|
||||
if (!CSSConstants.isUndefined(borderRadius)) {
|
||||
if (!YogaConstants.isUndefined(borderRadius)) {
|
||||
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
|
||||
}
|
||||
|
||||
@@ -520,9 +520,9 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
ViewProps.BORDER_RIGHT_WIDTH,
|
||||
ViewProps.BORDER_TOP_WIDTH,
|
||||
ViewProps.BORDER_BOTTOM_WIDTH,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderWidth(ReactEditText view, int index, float width) {
|
||||
if (!CSSConstants.isUndefined(width)) {
|
||||
if (!YogaConstants.isUndefined(width)) {
|
||||
width = PixelUtil.toPixelFromDIP(width);
|
||||
}
|
||||
view.setBorderWidth(SPACING_TYPES[index], width);
|
||||
@@ -532,8 +532,8 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
"borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "borderBottomColor"
|
||||
}, customType = "Color")
|
||||
public void setBorderColor(ReactEditText view, int index, Integer color) {
|
||||
float rgbComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
float rgbComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import android.util.TypedValue;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaDirection;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.MeasureOutput;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
@@ -73,9 +73,9 @@ public class ReactTextInputShadowNode extends ReactTextShadowNode implements
|
||||
public long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
YogaMeasureMode heightMode) {
|
||||
// measure() should never be called before setThemedContext()
|
||||
EditText editText = Assertions.assertNotNull(mEditText);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class ReactTextInputShadowNode extends ReactTextShadowNode implements
|
||||
super.onCollectExtraUpdates(uiViewOperationQueue);
|
||||
if (mComputedPadding != null) {
|
||||
float[] updatedPadding = mComputedPadding;
|
||||
if (getLayoutDirection() == CSSDirection.RTL) {
|
||||
if (getLayoutDirection() == YogaDirection.RTL) {
|
||||
updatedPadding = new float[] {
|
||||
getPadding(Spacing.END),
|
||||
getPadding(Spacing.TOP),
|
||||
|
||||
@@ -4,14 +4,14 @@ package com.facebook.react.views.view;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.facebook.csslayout.CSSMeasureMode;
|
||||
import com.facebook.csslayout.YogaMeasureMode;
|
||||
|
||||
public class MeasureUtil {
|
||||
|
||||
public static int getMeasureSpec(float size, CSSMeasureMode mode) {
|
||||
if (mode == CSSMeasureMode.EXACTLY) {
|
||||
public static int getMeasureSpec(float size, YogaMeasureMode mode) {
|
||||
if (mode == YogaMeasureMode.EXACTLY) {
|
||||
return View.MeasureSpec.makeMeasureSpec((int) size, View.MeasureSpec.EXACTLY);
|
||||
} else if (mode == CSSMeasureMode.AT_MOST) {
|
||||
} else if (mode == YogaMeasureMode.AT_MOST) {
|
||||
return View.MeasureSpec.makeMeasureSpec((int) size, View.MeasureSpec.AT_MOST);
|
||||
} else {
|
||||
return View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
|
||||
@@ -27,7 +27,7 @@ import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.uimanager.FloatUtil;
|
||||
import com.facebook.react.uimanager.Spacing;
|
||||
@@ -87,7 +87,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
private @Nullable RectF mTempRectForBorderRadius;
|
||||
private @Nullable RectF mTempRectForBorderRadiusOutline;
|
||||
private boolean mNeedUpdatePathForBorderRadius = false;
|
||||
private float mBorderRadius = CSSConstants.UNDEFINED;
|
||||
private float mBorderRadius = YogaConstants.UNDEFINED;
|
||||
|
||||
/* Used by all types of background and for drawing borders */
|
||||
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
@@ -100,7 +100,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
public void draw(Canvas canvas) {
|
||||
updatePathEffect();
|
||||
boolean roundedBorders = mBorderCornerRadii != null ||
|
||||
(!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0);
|
||||
(!YogaConstants.isUndefined(mBorderRadius) && mBorderRadius > 0);
|
||||
|
||||
if ((mBorderStyle == null || mBorderStyle == BorderStyle.SOLID) && !roundedBorders) {
|
||||
drawRectangularBackgroundWithBorders(canvas);
|
||||
@@ -145,7 +145,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
super.getOutline(outline);
|
||||
return;
|
||||
}
|
||||
if ((!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0) || mBorderCornerRadii != null) {
|
||||
if ((!YogaConstants.isUndefined(mBorderRadius) && mBorderRadius > 0) || mBorderCornerRadii != null) {
|
||||
updatePath();
|
||||
|
||||
outline.setConvexPath(mPathForBorderRadiusOutline);
|
||||
@@ -216,7 +216,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
public void setRadius(float radius, int position) {
|
||||
if (mBorderCornerRadii == null) {
|
||||
mBorderCornerRadii = new float[4];
|
||||
Arrays.fill(mBorderCornerRadii, CSSConstants.UNDEFINED);
|
||||
Arrays.fill(mBorderCornerRadii, YogaConstants.UNDEFINED);
|
||||
}
|
||||
|
||||
if (!FloatUtil.floatsEqual(mBorderCornerRadii[position], radius)) {
|
||||
@@ -277,11 +277,11 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
mTempRectForBorderRadius.inset(fullBorderWidth * 0.5f, fullBorderWidth * 0.5f);
|
||||
}
|
||||
|
||||
float defaultBorderRadius = !CSSConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0;
|
||||
float topLeftRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[0]) ? mBorderCornerRadii[0] : defaultBorderRadius;
|
||||
float topRightRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[1]) ? mBorderCornerRadii[1] : defaultBorderRadius;
|
||||
float bottomRightRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[2]) ? mBorderCornerRadii[2] : defaultBorderRadius;
|
||||
float bottomLeftRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[3]) ? mBorderCornerRadii[3] : defaultBorderRadius;
|
||||
float defaultBorderRadius = !YogaConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0;
|
||||
float topLeftRadius = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[0]) ? mBorderCornerRadii[0] : defaultBorderRadius;
|
||||
float topRightRadius = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[1]) ? mBorderCornerRadii[1] : defaultBorderRadius;
|
||||
float bottomRightRadius = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[2]) ? mBorderCornerRadii[2] : defaultBorderRadius;
|
||||
float bottomLeftRadius = mBorderCornerRadii != null && !YogaConstants.isUndefined(mBorderCornerRadii[3]) ? mBorderCornerRadii[3] : defaultBorderRadius;
|
||||
|
||||
mPathForBorderRadius.addRoundRect(
|
||||
mTempRectForBorderRadius,
|
||||
@@ -333,7 +333,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
* For rounded borders we use default "borderWidth" property.
|
||||
*/
|
||||
private float getFullBorderWidth() {
|
||||
return (mBorderWidth != null && !CSSConstants.isUndefined(mBorderWidth.getRaw(Spacing.ALL))) ?
|
||||
return (mBorderWidth != null && !YogaConstants.isUndefined(mBorderWidth.getRaw(Spacing.ALL))) ?
|
||||
mBorderWidth.getRaw(Spacing.ALL) : 0f;
|
||||
}
|
||||
|
||||
@@ -342,9 +342,9 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
* {@link #getFullBorderWidth}.
|
||||
*/
|
||||
private int getFullBorderColor() {
|
||||
float rgb = (mBorderRGB != null && !CSSConstants.isUndefined(mBorderRGB.getRaw(Spacing.ALL))) ?
|
||||
float rgb = (mBorderRGB != null && !YogaConstants.isUndefined(mBorderRGB.getRaw(Spacing.ALL))) ?
|
||||
mBorderRGB.getRaw(Spacing.ALL) : DEFAULT_BORDER_RGB;
|
||||
float alpha = (mBorderAlpha != null && !CSSConstants.isUndefined(mBorderAlpha.getRaw(Spacing.ALL))) ?
|
||||
float alpha = (mBorderAlpha != null && !YogaConstants.isUndefined(mBorderAlpha.getRaw(Spacing.ALL))) ?
|
||||
mBorderAlpha.getRaw(Spacing.ALL) : DEFAULT_BORDER_ALPHA;
|
||||
return ReactViewBackgroundDrawable.colorFromAlphaAndRGBComponents(alpha, rgb);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.YogaConstants;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
@@ -61,9 +61,9 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
|
||||
ViewProps.BORDER_TOP_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderRadius(ReactViewGroup view, int index, float borderRadius) {
|
||||
if (!CSSConstants.isUndefined(borderRadius)) {
|
||||
if (!YogaConstants.isUndefined(borderRadius)) {
|
||||
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
|
||||
}
|
||||
|
||||
@@ -134,9 +134,9 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
|
||||
ViewProps.BORDER_RIGHT_WIDTH,
|
||||
ViewProps.BORDER_TOP_WIDTH,
|
||||
ViewProps.BORDER_BOTTOM_WIDTH,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderWidth(ReactViewGroup view, int index, float width) {
|
||||
if (!CSSConstants.isUndefined(width)) {
|
||||
if (!YogaConstants.isUndefined(width)) {
|
||||
width = PixelUtil.toPixelFromDIP(width);
|
||||
}
|
||||
view.setBorderWidth(SPACING_TYPES[index], width);
|
||||
@@ -146,8 +146,8 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
|
||||
"borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "borderBottomColor"
|
||||
}, customType = "Color")
|
||||
public void setBorderColor(ReactViewGroup view, int index, Integer color) {
|
||||
float rgbComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? CSSConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
float rgbComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF);
|
||||
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color >>> 24);
|
||||
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user