Fix commit order of operations in Nodes
Summary: @public Split dispatchViewUpdates into two methods, which enables subclasses to commit pending ui operations, even when no root node is present. Differential Revision: D3011191
This commit is contained in:
parent
a541384621
commit
1a4d40df6c
|
@ -380,13 +380,20 @@ public class FlatUIImplementation extends UIImplementation {
|
|||
parentNode.addChildAt(childNode, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateViewHierarchy(EventDispatcher eventDispatcher) {
|
||||
mStateBuilder.beforeUpdateViewHierarchy();
|
||||
super.updateViewHierarchy(eventDispatcher);
|
||||
mStateBuilder.afterUpdateViewHierarchy(eventDispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyUpdatesRecursive(
|
||||
ReactShadowNode cssNode,
|
||||
float absoluteX,
|
||||
float absoluteY,
|
||||
EventDispatcher eventDispatcher) {
|
||||
mStateBuilder.applyUpdates(eventDispatcher, (FlatRootShadowNode) cssNode);
|
||||
mStateBuilder.applyUpdates((FlatRootShadowNode) cssNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -61,13 +61,15 @@ import com.facebook.react.uimanager.events.EventDispatcher;
|
|||
return mOperationsQueue;
|
||||
}
|
||||
|
||||
void beforeUpdateViewHierarchy() {
|
||||
commitViewUpdates();
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a root of the laid-out shadow node hierarchy, walks the tree and generates an array of
|
||||
* DrawCommands that will then mount in UI thread to a root FlatViewGroup so that it can draw.
|
||||
*/
|
||||
/* package */ void applyUpdates(EventDispatcher eventDispatcher, FlatShadowNode node) {
|
||||
commitViewUpdates();
|
||||
|
||||
/* package */ void applyUpdates(FlatShadowNode node) {
|
||||
float width = node.getLayoutWidth();
|
||||
float height = node.getLayoutHeight();
|
||||
float left = node.getLayoutX();
|
||||
|
@ -87,7 +89,9 @@ import com.facebook.react.uimanager.events.EventDispatcher;
|
|||
Float.POSITIVE_INFINITY);
|
||||
|
||||
updateViewBounds(node, left, top, right, bottom);
|
||||
}
|
||||
|
||||
void afterUpdateViewHierarchy(EventDispatcher eventDispatcher) {
|
||||
if (mDetachAllChildrenFromViews != null) {
|
||||
int[] viewsToDetachAllChildrenFrom = collectViewTags(mViewsToDetachAllChildrenFrom);
|
||||
mViewsToDetachAllChildrenFrom.clear();
|
||||
|
|
Loading…
Reference in New Issue