From cb117eeff71bb34ac2c892fb30630dd3b84a42cf Mon Sep 17 00:00:00 2001 From: darwin808 Date: Tue, 30 Dec 2025 16:32:27 +0800 Subject: [PATCH] fix: add configurable:true to Event phase constant property descriptors Fixes #54732 The Event class defines phase constants (NONE, CAPTURING_PHASE, AT_TARGET, BUBBLING_PHASE) using Object.defineProperty without configurable:true. This causes the event-target-shim library to fail when it tries to redefine these properties, breaking abort-controller and consequently fetch() in New Architecture apps. This adds configurable:true to all 8 property definitions (4 on Event class, 4 on Event.prototype) to match the standard behavior expected by DOM polyfills. --- .../react-native/src/private/webapis/dom/events/Event.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/react-native/src/private/webapis/dom/events/Event.js b/packages/react-native/src/private/webapis/dom/events/Event.js index 6f616735af8d29..3a8dfb2dcd3c10 100644 --- a/packages/react-native/src/private/webapis/dom/events/Event.js +++ b/packages/react-native/src/private/webapis/dom/events/Event.js @@ -184,48 +184,56 @@ export default class Event { // $FlowExpectedError[cannot-write] Object.defineProperty(Event, 'NONE', { + configurable: true, enumerable: true, value: 0, }); // $FlowExpectedError[cannot-write] Object.defineProperty(Event.prototype, 'NONE', { + configurable: true, enumerable: true, value: 0, }); // $FlowExpectedError[cannot-write] Object.defineProperty(Event, 'CAPTURING_PHASE', { + configurable: true, enumerable: true, value: 1, }); // $FlowExpectedError[cannot-write] Object.defineProperty(Event.prototype, 'CAPTURING_PHASE', { + configurable: true, enumerable: true, value: 1, }); // $FlowExpectedError[cannot-write] Object.defineProperty(Event, 'AT_TARGET', { + configurable: true, enumerable: true, value: 2, }); // $FlowExpectedError[cannot-write] Object.defineProperty(Event.prototype, 'AT_TARGET', { + configurable: true, enumerable: true, value: 2, }); // $FlowExpectedError[cannot-write] Object.defineProperty(Event, 'BUBBLING_PHASE', { + configurable: true, enumerable: true, value: 3, }); // $FlowExpectedError[cannot-write] Object.defineProperty(Event.prototype, 'BUBBLING_PHASE', { + configurable: true, enumerable: true, value: 3, });