BREAKING [react_native/css_layout] Update RN shadow nodes to hold CSSNode instead of extending CSSNode

Summary:
@public

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
This commit is contained in:
Andy Street authored and Ahmed El-Helw committed 2016-12-19 13:40:35 -08:00
1 parent 947e885487
commit 1d555bff22
6 files changed
+7 -16

No files matched your search

@@ -11,7 +11,6 @@ package com.facebook.react.flat;
import javax.annotation.Nullable;
import com.facebook.csslayout.CSSNodeDEPRECATED;
import com.facebook.csslayout.CSSNodeAPI;
import com.facebook.react.uimanager.ReactStylesDiffMap;
import com.facebook.react.uimanager.ReactShadowNode;
@@ -93,7 +92,7 @@ import com.facebook.react.uimanager.ViewManager;
}
@Override
public void addChildAt(CSSNodeDEPRECATED child, int i) {
public void addChildAt(ReactShadowNode child, int i) {
super.addChildAt(child, i);
if (mForceMountGrandChildrenToView && child instanceof FlatShadowNode) {
((FlatShadowNode) child).forceMountChildrenToView();