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.
This commit is contained in:
Sophie Alpert 2018-02-21 13:47:17 -08:00 committed by GitHub
parent 48ffbf06be
commit b17e4c204e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -31,6 +31,10 @@ const ReactNativeBridgeEventPlugin = {
nativeEvent: AnyNativeEvent,
nativeEventTarget: Object,
): ?Object {
if (targetInst == null) {
// Probably a node belonging to another renderer's tree.
return null;
}
const bubbleDispatchConfig = customBubblingEventTypes[topLevelType];
const directDispatchConfig = customDirectEventTypes[topLevelType];
invariant(