@samitouri / QOS-React-2 / commits / b17e4c204e

Ignore RN events on unknown nodes (#12264)

If we have multiple RN renderers running simultaneously, we should be able to send a single event to all of them and only if it recognizes the event will it do anything with it. Crucially, this avoids the 'Unsupported top level event type "%s" dispatched' invariant in those cases.

Sophie Alpert committed Feb 21, 2018 at 13:47 UTC b17e4c204e05de5ee360910626b0ccc938f37c06
1 file changed +4
packages/react-native-renderer/src/ReactNativeBridgeEventPlugin.js
+4
@@ -31,6 +31,10 @@ const ReactNativeBridgeEventPlugin = {
31 nativeEvent: AnyNativeEvent,
32 nativeEventTarget: Object,
33 ): ?Object {
34 + if (targetInst == null) {
35 + // Probably a node belonging to another renderer's tree.
36 + return null;
37 + }
38 const bubbleDispatchConfig = customBubblingEventTypes[topLevelType];
39 const directDispatchConfig = customDirectEventTypes[topLevelType];
40 invariant(