mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Rename enums
Differential Revision: D4244360 fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001
This commit is contained in:
committed by
Martin Konicek
parent
11a2b21e84
commit
d414fdc906
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user