mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-10 09:12:46 +08:00
Introduce @ReactProp-enabled LayoutShadowNode as a baseclass for most of the shadow nodes.
Differential Revision: D2540232 fb-gh-sync-id: 6dfed70c8253973897f4e447377ec5561862da23
This commit is contained in:
committed by
facebook-github-bot-9
parent
9493e96e13
commit
589df04846
@@ -34,14 +34,23 @@ public class ViewProps {
|
||||
public static final String HEIGHT = "height";
|
||||
public static final String JUSTIFY_CONTENT = "justifyContent";
|
||||
public static final String LEFT = "left";
|
||||
public static final String[] MARGINS = {
|
||||
"margin", "marginVertical", "marginHorizontal", "marginLeft", "marginRight", "marginTop",
|
||||
"marginBottom"
|
||||
};
|
||||
public static final String[] PADDINGS = {
|
||||
"padding", "paddingVertical", "paddingHorizontal", "paddingLeft", "paddingRight",
|
||||
"paddingTop", "paddingBottom"
|
||||
};
|
||||
|
||||
public static final String MARGIN = "margin";
|
||||
public static final String MARGIN_VERTICAL = "marginVertical";
|
||||
public static final String MARGIN_HORIZONTAL = "marginHorizontal";
|
||||
public static final String MARGIN_LEFT = "marginLeft";
|
||||
public static final String MARGIN_RIGHT = "marginRight";
|
||||
public static final String MARGIN_TOP = "marginTop";
|
||||
public static final String MARGIN_BOTTOM = "marginBottom";
|
||||
|
||||
public static final String PADDING = "padding";
|
||||
public static final String PADDING_VERTICAL = "paddingVertical";
|
||||
public static final String PADDING_HORIZONTAL = "paddingHorizontal";
|
||||
public static final String PADDING_LEFT = "paddingLeft";
|
||||
public static final String PADDING_RIGHT = "paddingRight";
|
||||
public static final String PADDING_TOP = "paddingTop";
|
||||
public static final String PADDING_BOTTOM = "paddingBottom";
|
||||
|
||||
public static final String POSITION = "position";
|
||||
public static final String RIGHT = "right";
|
||||
public static final String TOP = "top";
|
||||
@@ -61,6 +70,7 @@ public class ViewProps {
|
||||
public static final String ON = "on";
|
||||
public static final String RESIZE_MODE = "resizeMode";
|
||||
public static final String TEXT_ALIGN = "textAlign";
|
||||
|
||||
public static final String BORDER_WIDTH = "borderWidth";
|
||||
public static final String BORDER_LEFT_WIDTH = "borderLeftWidth";
|
||||
public static final String BORDER_TOP_WIDTH = "borderTopWidth";
|
||||
@@ -69,20 +79,13 @@ public class ViewProps {
|
||||
public static final int[] BORDER_SPACING_TYPES = {
|
||||
Spacing.ALL, Spacing.LEFT, Spacing.RIGHT, Spacing.TOP, Spacing.BOTTOM
|
||||
};
|
||||
public static final String[] BORDER_WIDTHS = {
|
||||
BORDER_WIDTH, BORDER_LEFT_WIDTH, BORDER_RIGHT_WIDTH, BORDER_TOP_WIDTH, BORDER_BOTTOM_WIDTH,
|
||||
};
|
||||
public static final int[] PADDING_MARGIN_SPACING_TYPES = {
|
||||
Spacing.ALL, Spacing.VERTICAL, Spacing.HORIZONTAL, Spacing.LEFT, Spacing.RIGHT, Spacing.TOP,
|
||||
Spacing.BOTTOM
|
||||
};
|
||||
|
||||
private static final HashSet<String> LAYOUT_ONLY_PROPS = createLayoutOnlyPropsMap();
|
||||
|
||||
private static HashSet<String> createLayoutOnlyPropsMap() {
|
||||
HashSet<String> layoutOnlyProps = SetBuilder.newHashSet();
|
||||
layoutOnlyProps.addAll(
|
||||
Arrays.asList(
|
||||
private static final HashSet<String> LAYOUT_ONLY_PROPS = new HashSet<>(
|
||||
Arrays.asList(
|
||||
ALIGN_SELF,
|
||||
ALIGN_ITEMS,
|
||||
BOTTOM,
|
||||
@@ -96,15 +99,25 @@ public class ViewProps {
|
||||
POSITION,
|
||||
RIGHT,
|
||||
TOP,
|
||||
WIDTH));
|
||||
for (int i = 0; i < MARGINS.length; i++) {
|
||||
layoutOnlyProps.add(MARGINS[i]);
|
||||
}
|
||||
for (int i = 0; i < PADDINGS.length; i++) {
|
||||
layoutOnlyProps.add(PADDINGS[i]);
|
||||
}
|
||||
return layoutOnlyProps;
|
||||
}
|
||||
WIDTH,
|
||||
|
||||
/* margins */
|
||||
MARGIN,
|
||||
MARGIN_VERTICAL,
|
||||
MARGIN_HORIZONTAL,
|
||||
MARGIN_LEFT,
|
||||
MARGIN_RIGHT,
|
||||
MARGIN_TOP,
|
||||
MARGIN_BOTTOM,
|
||||
|
||||
/* paddings */
|
||||
PADDING,
|
||||
PADDING_VERTICAL,
|
||||
PADDING_HORIZONTAL,
|
||||
PADDING_LEFT,
|
||||
PADDING_RIGHT,
|
||||
PADDING_TOP,
|
||||
PADDING_BOTTOM));
|
||||
|
||||
public static boolean isLayoutOnly(String prop) {
|
||||
return LAYOUT_ONLY_PROPS.contains(prop);
|
||||
|
||||
Reference in New Issue
Block a user