diff --git a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js index e638309de87fc8..177cbbdf300935 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 const registrations: ?Set> = 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); } }