diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java index a54e05d77..0cea29964 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java @@ -355,6 +355,25 @@ public class FlatUIImplementation extends UIImplementation { mStateBuilder.applyUpdates(eventDispatcher, rootNode); } + @Override + public void setJSResponder(int possiblyVirtualReactTag, boolean blockNativeResponder) { + ReactShadowNode node = resolveShadowNode(possiblyVirtualReactTag); + while (node.isVirtual()) { + node = node.getParent(); + } + + FlatShadowNode nonVirtualNode = (FlatShadowNode) node; + int nonVirtualTag = nonVirtualNode.getReactTag(); + nonVirtualNode.forceMountToView(); + mStateBuilder.ensureBackingViewIsCreated(nonVirtualNode, nonVirtualTag, null); + + FlatUIViewOperationQueue operationsQueue = mStateBuilder.getOperationsQueue(); + operationsQueue.enqueueSetJSResponder( + nonVirtualTag, + possiblyVirtualReactTag, + blockNativeResponder); + } + private static @Nullable ReactImageManager findReactImageManager(List viewManagers) { for (int i = 0, size = viewManagers.size(); i != size; ++i) { if (viewManagers.get(i) instanceof ReactImageManager) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java b/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java index 31e0243f7..989a27618 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/StateBuilder.java @@ -52,6 +52,10 @@ import com.facebook.react.uimanager.events.EventDispatcher; mOperationsQueue = operationsQueue; } + /* package */ FlatUIViewOperationQueue getOperationsQueue() { + return mOperationsQueue; + } + /** * 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.