diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java index a8c7d6a4c..b73b533d8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatShadowNode.java @@ -35,6 +35,7 @@ import com.facebook.react.uimanager.annotations.ReactProp; private static final String PROP_ACCESSIBILITY_LIVE_REGION = "accessibilityLiveRegion"; private static final String PROP_IMPORTANT_FOR_ACCESSIBILITY = "importantForAccessibility"; private static final String PROP_TEST_ID = "testID"; + private static final String PROP_TRANSFORM = "transform"; private DrawCommand[] mDrawCommands = DrawCommand.EMPTY_ARRAY; private AttachDetachListener[] mAttachDetachListeners = AttachDetachListener.EMPTY_ARRAY; @@ -72,6 +73,7 @@ import com.facebook.react.uimanager.annotations.ReactProp; styles.hasKey(PROP_ACCESSIBILITY_LABEL) || styles.hasKey(PROP_ACCESSIBILITY_COMPONENT_TYPE) || styles.hasKey(PROP_ACCESSIBILITY_LIVE_REGION) || + styles.hasKey(PROP_TRANSFORM) || styles.hasKey(PROP_IMPORTANT_FOR_ACCESSIBILITY)) { forceMountToView(); } 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 f149bb8b8..99a4b7e1f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java @@ -465,10 +465,18 @@ public class FlatUIImplementation extends UIImplementation { while (node.isVirtual()) { node = node.getParent(); } + int tag = node.getReactTag(); + + // if the node in question doesn't mount to a View, find the first parent that does mount to + // a View. without this, we'll crash when we try to set the JSResponder, since part of that + // is to find the parent view and ask it to not intercept touch events. + while (node instanceof FlatShadowNode && !((FlatShadowNode) node).mountsToView()) { + node = node.getParent(); + } FlatUIViewOperationQueue operationsQueue = mStateBuilder.getOperationsQueue(); operationsQueue.enqueueSetJSResponder( - node.getReactTag(), + node == null ? tag : node.getReactTag(), possiblyVirtualReactTag, blockNativeResponder); }