From fd10410d512423933ff12f4264e975226aa4b351 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Tue, 30 Jun 2026 14:08:11 -0700 Subject: [PATCH] Remove Modal animated prop (#57385) Summary: Removes the deprecated `animated` prop from `Modal`. It was a no-op everywhere. Use `animationType` instead. See https://github.com/react/react-native/issues/57384 ## Changelog: [GENERAL] [REMOVED] - Remove deprecated `Modal` `animated` prop Pull Request resolved: https://github.com/react/react-native/pull/57385 Test Plan: - `yarn jest packages/react-native/Libraries/Modal` - `yarn flow` and `tsc` pass with the prop removed from `Modal.js` / `Modal.d.ts`. Reviewed By: huntie Differential Revision: D110205204 Pulled By: cortinico fbshipit-source-id: 8e5b4d7dc8811d7270de3776476e7f868eafddd5 --- .../react-native/Libraries/Modal/Modal.d.ts | 4 ---- packages/react-native/Libraries/Modal/Modal.js | 5 ----- .../Libraries/Modal/__tests__/Modal-itest.js | 18 ------------------ .../ReactAndroid/api/ReactAndroid.api | 1 - .../react/views/modal/ReactModalHostManager.kt | 3 --- packages/react-native/ReactNativeApi.d.ts | 9 ++++----- .../RCTModalHostViewNativeComponent.js | 5 ----- .../api-snapshots/ReactAndroidDebugCxx.api | 1 - .../api-snapshots/ReactAndroidNewarchCxx.api | 1 - .../api-snapshots/ReactAndroidReleaseCxx.api | 1 - .../api-snapshots/ReactAppleDebugCxx.api | 1 - .../api-snapshots/ReactAppleNewarchCxx.api | 1 - .../api-snapshots/ReactAppleReleaseCxx.api | 1 - 13 files changed, 4 insertions(+), 47 deletions(-) diff --git a/packages/react-native/Libraries/Modal/Modal.d.ts b/packages/react-native/Libraries/Modal/Modal.d.ts index 88af235fe13..db4e023be70 100644 --- a/packages/react-native/Libraries/Modal/Modal.d.ts +++ b/packages/react-native/Libraries/Modal/Modal.d.ts @@ -13,10 +13,6 @@ import {NativeSyntheticEvent} from '../Types/CoreEventTypes'; import {ColorValue} from '../StyleSheet/StyleSheet'; export interface ModalBaseProps { - /** - * @deprecated Use animationType instead - */ - animated?: boolean | undefined; /** * The `animationType` prop controls how the modal animates. * diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index 0565e0b116f..e9201f02ff3 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -59,11 +59,6 @@ type OrientationChangeEvent = Readonly<{ /** @build-types emit-as-interface Uniwind compatibility */ export type ModalBaseProps = { - /** - * @deprecated Use `animationType` instead. - */ - animated?: boolean, - /** * Controls how the modal animates. `'slide'` slides in from the bottom, * `'fade'` fades into view, `'none'` appears without animation. diff --git a/packages/react-native/Libraries/Modal/__tests__/Modal-itest.js b/packages/react-native/Libraries/Modal/__tests__/Modal-itest.js index a36c2750184..ce4ea810932 100644 --- a/packages/react-native/Libraries/Modal/__tests__/Modal-itest.js +++ b/packages/react-native/Libraries/Modal/__tests__/Modal-itest.js @@ -301,24 +301,6 @@ describe('', () => { ); }); }); - - describe('animated', () => { - [true, false].forEach(animated => { - // The 'animated' prop is deprecated and ignored when the Modal is rendered - // Users should use the 'animationType' prop instead. - it(`[DEPRECATED] renders a Modal with animated="${animated ? 'true' : 'false'}"`, () => { - Fantom.runTask(() => { - root.render(); - }); - - expect(root.getRenderedOutput({props: ['animated']}).toJSX()).toEqual( - - - , - ); - }); - }); - }); // ... more props }); describe('ref', () => { diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 5e2aadd12ae..699c267339a 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -5096,7 +5096,6 @@ public class com/facebook/react/viewmanagers/ModalHostViewManagerDelegate : com/ public abstract interface class com/facebook/react/viewmanagers/ModalHostViewManagerInterface : com/facebook/react/uimanager/ViewManagerWithGeneratedInterface { public abstract fun setAllowSwipeDismissal (Landroid/view/View;Z)V - public abstract fun setAnimated (Landroid/view/View;Z)V public abstract fun setAnimationType (Landroid/view/View;Ljava/lang/String;)V public abstract fun setHardwareAccelerated (Landroid/view/View;Z)V public abstract fun setIdentifier (Landroid/view/View;I)V diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt index 08271631cdf..c251acd4d62 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt @@ -72,9 +72,6 @@ internal class ReactModalHostManager : @ReactProp(name = "presentationStyle") override fun setPresentationStyle(view: ReactModalHostView, value: String?): Unit = Unit - @ReactProp(name = "animated") - override fun setAnimated(view: ReactModalHostView, value: Boolean): Unit = Unit - @ReactProp(name = "supportedOrientations") override fun setSupportedOrientations(view: ReactModalHostView, value: ReadableArray?): Unit = Unit diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts index 699c2fff455..bfebffaa6fc 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -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<<42200de8ca10d30541e23b67547d9a13>> + * @generated SignedSource<<20bbe8284af4b8863a39651a46b7a53a>> * * This file was generated by scripts/js-api/build-types/index.js. */ @@ -3098,7 +3098,6 @@ declare type Message = { } declare type Modal = typeof Modal declare interface ModalBaseProps { - animated?: boolean animationType?: "fade" | "none" | "slide" backdropColor?: ColorValue modalRef?: React.Ref @@ -6038,10 +6037,10 @@ export { MeasureInWindowOnSuccessCallback, // a285f598 MeasureLayoutOnSuccessCallback, // 3592502a MeasureOnSuccessCallback, // 82824e59 - Modal, // c8c01498 - ModalBaseProps, // 71945951 + Modal, // 43f50013 + ModalBaseProps, // ac3931ad ModalInstance, // d466ce77 - ModalProps, // 9f060027 + ModalProps, // 35252d68 ModalPropsAndroid, // 515fb173 ModalPropsIOS, // 0e13cfcc ModeChangeEvent, // f64bf69d diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js index eaf91f167ef..d683103236a 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js @@ -107,11 +107,6 @@ type RCTModalHostViewNativeProps = Readonly<{ */ visible?: WithDefault, - /** - * Deprecated. Use the `animationType` prop instead. - */ - animated?: WithDefault, - /** * Controls whether the modal can be dismissed by swiping down on iOS. * This requires you to implement the `onRequestClose` prop to handle the dismissal. diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api index 5a33e7d7d9d..429dedfc5d2 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api @@ -3350,7 +3350,6 @@ class facebook::react::ModalHostViewProps : public facebook::react::HostPlatform public ModalHostViewProps() = default; public ModalHostViewProps(const facebook::react::PropsParserContext& context, const facebook::react::ModalHostViewProps& sourceProps, const facebook::react::RawProps& rawProps); public bool allowSwipeDismissal; - public bool animated; public bool hardwareAccelerated; public bool navigationBarTranslucent; public bool statusBarTranslucent; diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api index a10464aed19..35d4903d0ce 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api @@ -3252,7 +3252,6 @@ class facebook::react::ModalHostViewProps : public facebook::react::HostPlatform public ModalHostViewProps() = default; public ModalHostViewProps(const facebook::react::PropsParserContext& context, const facebook::react::ModalHostViewProps& sourceProps, const facebook::react::RawProps& rawProps); public bool allowSwipeDismissal; - public bool animated; public bool hardwareAccelerated; public bool navigationBarTranslucent; public bool statusBarTranslucent; diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api index b357d56bfc8..8cf9ec3d407 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api @@ -3347,7 +3347,6 @@ class facebook::react::ModalHostViewProps : public facebook::react::HostPlatform public ModalHostViewProps() = default; public ModalHostViewProps(const facebook::react::PropsParserContext& context, const facebook::react::ModalHostViewProps& sourceProps, const facebook::react::RawProps& rawProps); public bool allowSwipeDismissal; - public bool animated; public bool hardwareAccelerated; public bool navigationBarTranslucent; public bool statusBarTranslucent; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 4dd76e3aa93..2505b89426a 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -5572,7 +5572,6 @@ class facebook::react::ModalHostViewProps : public facebook::react::HostPlatform public ModalHostViewProps() = default; public ModalHostViewProps(const facebook::react::PropsParserContext& context, const facebook::react::ModalHostViewProps& sourceProps, const facebook::react::RawProps& rawProps); public bool allowSwipeDismissal; - public bool animated; public bool hardwareAccelerated; public bool navigationBarTranslucent; public bool statusBarTranslucent; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index 16e2dc5a0c8..e86099d6f8a 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -5496,7 +5496,6 @@ class facebook::react::ModalHostViewProps : public facebook::react::HostPlatform public ModalHostViewProps() = default; public ModalHostViewProps(const facebook::react::PropsParserContext& context, const facebook::react::ModalHostViewProps& sourceProps, const facebook::react::RawProps& rawProps); public bool allowSwipeDismissal; - public bool animated; public bool hardwareAccelerated; public bool navigationBarTranslucent; public bool statusBarTranslucent; diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 48d9cc57fdb..97e1c11230c 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -5569,7 +5569,6 @@ class facebook::react::ModalHostViewProps : public facebook::react::HostPlatform public ModalHostViewProps() = default; public ModalHostViewProps(const facebook::react::PropsParserContext& context, const facebook::react::ModalHostViewProps& sourceProps, const facebook::react::RawProps& rawProps); public bool allowSwipeDismissal; - public bool animated; public bool hardwareAccelerated; public bool navigationBarTranslucent; public bool statusBarTranslucent;