From e9753a11aeb910221f86a42156d157cf17049d8a Mon Sep 17 00:00:00 2001 From: Denis Koroskin Date: Tue, 15 Dec 2015 22:31:29 -0800 Subject: [PATCH] Don't collect state for virtual nodes Summary: Virtual nodes (such as RCTRawText and RCTVirtualText) have no state or node regions, don't need to be laid out, and thus should not be checked for state. Reviewed By: ahmedre Differential Revision: D2757089 --- .../com/facebook/react/flat/StateBuilder.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java b/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java index 97e34aa00..54b536f9f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java @@ -270,10 +270,25 @@ import com.facebook.react.uimanager.CatalystStylesDiffMap; for (int i = 0, childCount = node.getChildCount(); i != childCount; ++i) { FlatShadowNode child = (FlatShadowNode) node.getChildAt(i); + if (child.isVirtual()) { + markLayoutSeenRecursively(child); + continue; + } + processNodeAndCollectState(child, left, top, isAndroidView, needsCustomLayoutForChildren); } } + private void markLayoutSeenRecursively(FlatShadowNode node) { + if (node.hasNewLayout()) { + node.markLayoutSeen(); + } + + for (int i = 0, childCount = node.getChildCount(); i != childCount; ++i) { + markLayoutSeenRecursively((FlatShadowNode) node.getChildAt(i)); + } + } + /** * Collects state and updates View boundaries for a given node tree. */