Implement {min,max}{Width,Height} in ReactAndroid
Reviewed By: astreet Differential Revision: D3424294 fbshipit-source-id: 03ae663927600bff025cd953a9b6b221c8dd9f23
This commit is contained in:
parent
78b892906b
commit
1579a72ca6
|
@ -26,11 +26,31 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||||
setStyleWidth(CSSConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
|
setStyleWidth(CSSConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||||
|
public void setMinWidth(float minWidth) {
|
||||||
|
setStyleMinWidth(CSSConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(minWidth));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ReactProp(name = ViewProps.MAX_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||||
|
public void setMaxWidth(float maxWidth) {
|
||||||
|
setStyleMaxWidth(CSSConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
|
||||||
|
}
|
||||||
|
|
||||||
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||||
public void setHeight(float height) {
|
public void setHeight(float height) {
|
||||||
setStyleHeight(CSSConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
|
setStyleHeight(CSSConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactProp(name = ViewProps.MIN_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||||
|
public void setMinHeight(float minHeight) {
|
||||||
|
setStyleMinHeight(CSSConstants.isUndefined(minHeight) ? minHeight : PixelUtil.toPixelFromDIP(minHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ReactProp(name = ViewProps.MAX_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||||
|
public void setMaxHeight(float maxHeight) {
|
||||||
|
setStyleMaxHeight(CSSConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
|
||||||
|
}
|
||||||
|
|
||||||
@ReactProp(name = ViewProps.LEFT, defaultFloat = CSSConstants.UNDEFINED)
|
@ReactProp(name = ViewProps.LEFT, defaultFloat = CSSConstants.UNDEFINED)
|
||||||
public void setLeft(float left) {
|
public void setLeft(float left) {
|
||||||
setPositionLeft(CSSConstants.isUndefined(left) ? left : PixelUtil.toPixelFromDIP(left));
|
setPositionLeft(CSSConstants.isUndefined(left) ? left : PixelUtil.toPixelFromDIP(left));
|
||||||
|
|
|
@ -56,6 +56,11 @@ public class ViewProps {
|
||||||
public static final String TOP = "top";
|
public static final String TOP = "top";
|
||||||
public static final String WIDTH = "width";
|
public static final String WIDTH = "width";
|
||||||
|
|
||||||
|
public static final String MIN_WIDTH = "minWidth";
|
||||||
|
public static final String MAX_WIDTH = "maxWidth";
|
||||||
|
public static final String MIN_HEIGHT = "minHeight";
|
||||||
|
public static final String MAX_HEIGHT = "maxHeight";
|
||||||
|
|
||||||
// Props that affect more than just layout
|
// Props that affect more than just layout
|
||||||
public static final String ENABLED = "enabled";
|
public static final String ENABLED = "enabled";
|
||||||
public static final String BACKGROUND_COLOR = "backgroundColor";
|
public static final String BACKGROUND_COLOR = "backgroundColor";
|
||||||
|
@ -96,18 +101,26 @@ public class ViewProps {
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
ALIGN_SELF,
|
ALIGN_SELF,
|
||||||
ALIGN_ITEMS,
|
ALIGN_ITEMS,
|
||||||
BOTTOM,
|
|
||||||
COLLAPSABLE,
|
COLLAPSABLE,
|
||||||
FLEX,
|
FLEX,
|
||||||
FLEX_DIRECTION,
|
FLEX_DIRECTION,
|
||||||
FLEX_WRAP,
|
FLEX_WRAP,
|
||||||
HEIGHT,
|
|
||||||
JUSTIFY_CONTENT,
|
JUSTIFY_CONTENT,
|
||||||
LEFT,
|
|
||||||
|
/* position */
|
||||||
POSITION,
|
POSITION,
|
||||||
RIGHT,
|
RIGHT,
|
||||||
TOP,
|
TOP,
|
||||||
|
BOTTOM,
|
||||||
|
LEFT,
|
||||||
|
|
||||||
|
/* dimensions */
|
||||||
WIDTH,
|
WIDTH,
|
||||||
|
HEIGHT,
|
||||||
|
MIN_WIDTH,
|
||||||
|
MAX_WIDTH,
|
||||||
|
MIN_HEIGHT,
|
||||||
|
MAX_HEIGHT,
|
||||||
|
|
||||||
/* margins */
|
/* margins */
|
||||||
MARGIN,
|
MARGIN,
|
||||||
|
|
Loading…
Reference in New Issue