Fix StateBuilder incorrectly casting a child to FlatShadowNode

Summary: Not every CSSNode in a hierarchy is a FlatShadowNode, some virtual nodes can be ReactShadowNodes for compatibility with ART nodes. This diff fixes StateBuilder unconditionally casting a node to FlatShadowNode, which is causing a crash in Groups.

Reviewed By: nickholub

Differential Revision: D2941031
This commit is contained in:
Denis Koroskin 2016-02-17 11:53:20 -08:00 committed by Ahmed El-Helw
parent d1ccb6d23d
commit b461c70b76
1 changed files with 4 additions and 4 deletions

View File

@ -13,9 +13,9 @@ import javax.annotation.Nullable;
import java.util.ArrayList;
import com.facebook.csslayout.CSSNode;
import com.facebook.csslayout.Spacing;
import com.facebook.react.uimanager.OnLayoutEvent;
import com.facebook.react.uimanager.ReactShadowNode;
import com.facebook.react.uimanager.ReactStylesDiffMap;
import com.facebook.react.uimanager.events.EventDispatcher;
@ -387,14 +387,14 @@ import com.facebook.react.uimanager.events.EventDispatcher;
node.collectState(this, left, top, right, bottom, clipLeft, clipTop, clipRight, clipBottom);
for (int i = 0, childCount = node.getChildCount(); i != childCount; ++i) {
FlatShadowNode child = (FlatShadowNode) node.getChildAt(i);
ReactShadowNode child = node.getChildAt(i);
if (child.isVirtual()) {
markLayoutSeenRecursively(child);
continue;
}
processNodeAndCollectState(
child,
(FlatShadowNode) child,
left,
top,
clipLeft,
@ -406,7 +406,7 @@ import com.facebook.react.uimanager.events.EventDispatcher;
}
}
private void markLayoutSeenRecursively(CSSNode node) {
private void markLayoutSeenRecursively(ReactShadowNode node) {
if (node.hasNewLayout()) {
node.markLayoutSeen();
}