mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Ignore events fired on missing React Native instances
This can happen if something gets unmounted before the event gets dispatched. I'm not sure how this works out exactly but this preserves previous behavior in this scenario.
This commit is contained in:
@@ -120,6 +120,11 @@ var ReactNativeEventEmitter = merge(ReactEventEmitterMixin, {
|
||||
) {
|
||||
var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT;
|
||||
var inst = ReactNativeComponentTree.getInstanceFromNode(rootNodeID);
|
||||
if (!inst) {
|
||||
// If the original instance is already gone, we don't have to dispatch
|
||||
// any events.
|
||||
return;
|
||||
}
|
||||
ReactUpdates.batchedUpdates(function() {
|
||||
ReactNativeEventEmitter.handleTopLevel(
|
||||
topLevelType,
|
||||
|
||||
Reference in New Issue
Block a user