From 84ae1c9aecf38fdb1e02e0dea3ee7f9e73728e9f Mon Sep 17 00:00:00 2001 From: David Vacca Date: Fri, 6 Apr 2018 15:01:15 -0700 Subject: [PATCH] Move execution of Yoga.calculateLayout method before diffing algorithm Reviewed By: shergin Differential Revision: D7495581 fbshipit-source-id: 63d2f2a66c53727dea7981837d6d0f896bac35d3 --- .../react/fabric/FabricUIManager.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index 52519e9d31291f..0e7f8e7724a637 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -256,20 +256,12 @@ public synchronized void completeRoot(int rootTag, List childLi currentRootShadowNode, "Root view with tag " + rootTag + " must be added before completeRoot is called"); - currentRootShadowNode = calculateDiffingAndCreateNewRootNode(currentRootShadowNode, childList); - if (DEBUG) { - Log.d(TAG, "ReactShadowNodeHierarchy after diffing: " + currentRootShadowNode.getHierarchyInfo()); - } - - notifyOnBeforeLayoutRecursive(currentRootShadowNode); - currentRootShadowNode.calculateLayout(); - if (DEBUG) { Log.d( TAG, - "ReactShadowNodeHierarchy after calculate Layout: " + currentRootShadowNode.getHierarchyInfo()); + "ReactShadowNodeHierarchy after diffing: " + currentRootShadowNode.getHierarchyInfo()); } applyUpdatesRecursive(currentRootShadowNode, 0, 0); @@ -299,6 +291,21 @@ private ReactShadowNode calculateDiffingAndCreateNewRootNode( appendChild(newRootShadowNode, child); } + if (DEBUG) { + Log.d( + TAG, + "ReactShadowNodeHierarchy before calculateLayout: " + newRootShadowNode.getHierarchyInfo()); + } + + notifyOnBeforeLayoutRecursive(newRootShadowNode); + newRootShadowNode.calculateLayout(); + + if (DEBUG) { + Log.d( + TAG, + "ReactShadowNodeHierarchy after calculateLayout: " + newRootShadowNode.getHierarchyInfo()); + } + mFabricReconciler.manageChildren(currentRootShadowNode, newRootShadowNode); return newRootShadowNode; }