Permalink
Browse files

BREAKING [react_native/css_layout] Update RN shadow nodes to hold CSS…

…Node instead of extending CSSNode

Summary:
This diff makes it so ReactShadowNode holds a CSSNode instead of extending one. This will enable us to pool and re-use CSSNodes and will allow us to keep from breaking the CSSNode api assumption that nodes that have measure functions don't have children (right now, text nodes have measure functions, but they also have raw text children).

BREAKING
This diff makes ReactShadowNode no longer extend CSSNodeDEPRECATED. If you have code that depended on that, e.g. via instanceof checks, that will no longer work as expected. Subclasses that override getChildAt/addChildAt/etc will need to update your method signatures. There should be no runtime behavior changes.

Reviewed By: emilsjolander

Differential Revision: D4153818

fbshipit-source-id: 2836434dd925d8e4651b9bb94b602c235e1e7665
  • Loading branch information...
1 parent 307871e commit 0df65bb7d4fcb935b3dea589f3cb7b73a5d52483 @astreet astreet committed with Facebook Github Bot Nov 14, 2016
@@ -29,27 +29,32 @@ public void setWidth(float width) {
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
public void setMinWidth(float minWidth) {
- setStyleMinWidth(CSSConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(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));
+ setStyleMaxWidth(
+ CSSConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
}
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
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));
+ 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));
+ setStyleMaxHeight(
+ CSSConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
}
@ReactProp(name = ViewProps.FLEX, defaultFloat = 0f)
@@ -81,7 +86,8 @@ public void setFlexDirection(@Nullable String flexDirection) {
@ReactProp(name = ViewProps.FLEX_WRAP)
public void setFlexWrap(@Nullable String flexWrap) {
- setWrap(flexWrap == null ? CSSWrap.NOWRAP : CSSWrap.valueOf(flexWrap.toUpperCase(Locale.US)));
+ setFlexWrap(
+ flexWrap == null ? CSSWrap.NOWRAP : CSSWrap.valueOf(flexWrap.toUpperCase(Locale.US)));
}
@ReactProp(name = ViewProps.ALIGN_SELF)
Oops, something went wrong.

0 comments on commit 0df65bb

Please sign in to comment.