mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-05 22:38:59 +08:00
Fix dispatchViewManagerCommand ordering for Nodes
Summary: The dispatchViewManager command should, according to the spec, only be executed after children are added. On Nodes, however, due to the fact that the Views in question may not have been created until the call to the command occurred, the dispatchViewManagerCommand may occur too early. Consequently, ensure that we apply any state updates to the Node represented by that reactTag before we enqueue the view manager command (this will ensure that views are properly added to the parent, etc before sending the command). Reviewed By: astreet Differential Revision: D3428855
This commit is contained in:
@@ -244,6 +244,10 @@ public class FlatUIImplementation extends UIImplementation {
|
||||
@Override
|
||||
public void dispatchViewManagerCommand(int reactTag, int commandId, ReadableArray commandArgs) {
|
||||
ensureMountsToViewAndBackingViewIsCreated(reactTag);
|
||||
// need to make sure any ui operations (UpdateViewGroup, for example, etc) have already
|
||||
// happened before we actually dispatch the view manager command (since otherwise, the command
|
||||
// may go to an empty shell parent without its children, which is against the specs).
|
||||
mStateBuilder.applyUpdates((FlatShadowNode) resolveShadowNode(reactTag));
|
||||
super.dispatchViewManagerCommand(reactTag, commandId, commandArgs);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user