From e99f84e342827a16b2902c3f0f4b806259dab171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Mon, 19 Oct 2026 04:01:13 -0700 Subject: [PATCH] Remove enableImperativeEvents_DEPRECATED feature flag Summary: The JS-only `enableImperativeEvents_DEPRECATED` flag was kept so JS bundles delivered to older native builds, where the common `enableImperativeEvents` flag was unavailable, could still enable the feature. Those builds are gone, so remove the deprecated flag and gate `ReactNativeElement` and `ReadOnlyText` solely on the common flag. Changelog: [Internal] Differential Revision: D126047688 --- .../featureflags/ReactNativeFeatureFlags.config.js | 10 ---------- .../private/featureflags/ReactNativeFeatureFlags.js | 8 +------- .../private/webapis/dom/nodes/ReactNativeElement.js | 10 ++++------ .../src/private/webapis/dom/nodes/ReadOnlyText.js | 10 ++++------ 4 files changed, 9 insertions(+), 29 deletions(-) diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 0a76242a2c75..2c0786728b99 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -1116,16 +1116,6 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, - enableImperativeEvents_DEPRECATED: { - defaultValue: false, - metadata: { - description: - 'Deprecated in favor of the common flag with the same name, which is the one that can be configured by OSS release stage. This is only kept so JS bundles delivered to older native builds, where the common flag is unavailable, can still enable the feature.', - expectedReleaseValue: true, - purpose: 'release', - }, - ossReleaseStage: 'none', - }, enableNativeEventTargetEventDispatching: { defaultValue: true, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 1f474567697e..c190a2488b08 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<4eb26b4190d023d26a50f54b6e3ea5eb>> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -34,7 +34,6 @@ export type ReactNativeFeatureFlagsJsOnly = Readonly<{ animatedKeepListenersOnDetach: Getter, animatedShouldSyncValueBeforeStartCallback: Getter, deferFlatListFocusChangeRenderUpdate: Getter, - enableImperativeEvents_DEPRECATED: Getter, enableNativeEventTargetEventDispatching: Getter, externalElementInspectionEnabled: Getter, fixCrossOrientationNestedListViewability: Getter, @@ -176,11 +175,6 @@ export const animatedShouldSyncValueBeforeStartCallback: Getter = creat */ export const deferFlatListFocusChangeRenderUpdate: Getter = createJavaScriptFlagGetter('deferFlatListFocusChangeRenderUpdate', false); -/** - * Deprecated in favor of the common flag with the same name, which is the one that can be configured by OSS release stage. This is only kept so JS bundles delivered to older native builds, where the common flag is unavailable, can still enable the feature. - */ -export const enableImperativeEvents_DEPRECATED: Getter = createJavaScriptFlagGetter('enableImperativeEvents_DEPRECATED', false); - /** * When enabled, the React Native renderer dispatches events through the W3C EventTarget API (addEventListener/dispatchEvent) instead of the legacy plugin-based system. */ diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js b/packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js index 6e236da106a2..2ba8b0df8b38 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js @@ -360,14 +360,12 @@ ReactNativeElement_public.prototype = ReactNativeElement.prototype; // `removeEventListener`, `dispatchEvent`) is only inherited by this final class // when `enableNativeEventTargetEventDispatching` is enabled (which makes // `ReadOnlyNode` extend `EventTarget`). Until that public API is finalized, it -// is gated behind `enableImperativeEvents` (or its deprecated JS-only -// counterpart, `enableImperativeEvents_DEPRECATED`): when both flags are off we -// remove those methods from this final class. Native/internal event dispatch -// does not rely on these public methods, so removing them is safe. +// is gated behind `enableImperativeEvents`: when off we remove those methods +// from this final class. Native/internal event dispatch does not rely on these +// public methods, so removing them is safe. if ( ReactNativeFeatureFlags.enableNativeEventTargetEventDispatching() && - !ReactNativeFeatureFlags.enableImperativeEvents() && - !ReactNativeFeatureFlags.enableImperativeEvents_DEPRECATED() + !ReactNativeFeatureFlags.enableImperativeEvents() ) { const prototype: interface { addEventListener?: unknown, diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyText.js b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyText.js index 1c0b819401e2..80626774ae88 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyText.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyText.js @@ -45,14 +45,12 @@ ReadOnlyText_public.prototype = ReadOnlyText.prototype; // `removeEventListener`, `dispatchEvent`) is only inherited by this final class // when `enableNativeEventTargetEventDispatching` is enabled (which makes // `ReadOnlyNode` extend `EventTarget`). Until that public API is finalized, it -// is gated behind `enableImperativeEvents` (or its deprecated JS-only -// counterpart, `enableImperativeEvents_DEPRECATED`): when both flags are off we -// remove those methods from this final class. Native/internal event dispatch -// does not rely on these public methods, so removing them is safe. +// is gated behind `enableImperativeEvents`: when off we remove those methods +// from this final class. Native/internal event dispatch does not rely on these +// public methods, so removing them is safe. if ( ReactNativeFeatureFlags.enableNativeEventTargetEventDispatching() && - !ReactNativeFeatureFlags.enableImperativeEvents() && - !ReactNativeFeatureFlags.enableImperativeEvents_DEPRECATED() + !ReactNativeFeatureFlags.enableImperativeEvents() ) { const prototype: interface { addEventListener?: unknown,