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
This commit is contained in:
Ahmed El-Helw 2016-03-04 16:20:47 -08:00 committed by Facebook Github Bot 2
parent 71e59761c9
commit 21b7bf4728
1 changed files with 6 additions and 3 deletions

View File

@ -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);
}
/**