diff --git a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js index 6bd20257222d73..a98ce92939b3c1 100644 --- a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js +++ b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js @@ -109,7 +109,9 @@ export default class EventEmitter Registration<$ElementType>, > = this._registry[eventType]; if (registrations != null) { - for (const registration of [...registrations]) { + // Copy `registrations` to take a snapshot when we invoke `emit`, in case + // registrations are added or removed when listeners are invoked. + for (const registration of Array.from(registrations)) { registration.listener.apply(registration.context, args); } }