From 21b7bf4728ee5808625e14dcd34146ada8a1ee64 Mon Sep 17 00:00:00 2001 From: Ahmed El-Helw Date: Fri, 4 Mar 2016 16:20:47 -0800 Subject: [PATCH] Fix commit order of operations in Nodes Summary: Split dispatchViewUpdates into two methods, which enables subclasses to commit pending ui operations, even when no root node is present. Differential Revision: D3011191 fb-gh-sync-id: a3491179441223aeffe21ff483dda582053768e7 shipit-source-id: a3491179441223aeffe21ff483dda582053768e7 --- .../com/facebook/react/uimanager/UIImplementation.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java index 9e63b313f..b407c416a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java @@ -446,6 +446,12 @@ public class UIImplementation { * Invoked at the end of the transaction to commit any updates to the node hierarchy. */ public void dispatchViewUpdates(EventDispatcher eventDispatcher, int batchId) { + updateViewHierarchy(eventDispatcher); + mNativeViewHierarchyOptimizer.onBatchComplete(); + mOperationsQueue.dispatchViewUpdates(batchId); + } + + protected void updateViewHierarchy(EventDispatcher eventDispatcher) { for (int i = 0; i < mShadowNodeRegistry.getRootNodeCount(); i++) { int tag = mShadowNodeRegistry.getRootTag(i); ReactShadowNode cssRoot = mShadowNodeRegistry.getNode(tag); @@ -454,9 +460,6 @@ public class UIImplementation { calculateRootLayout(cssRoot); applyUpdatesRecursive(cssRoot, 0f, 0f, eventDispatcher); } - - mNativeViewHierarchyOptimizer.onBatchComplete(); - mOperationsQueue.dispatchViewUpdates(batchId); } /**