From f1710c845a390205f63033b637701273c093dc1e Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Wed, 1 Jul 2026 15:20:52 +0200 Subject: [PATCH] Deprecate DrawerLayoutAndroid --- .../DrawerAndroid/DrawerLayoutAndroid.android.js | 6 +++++- .../Components/DrawerAndroid/DrawerLayoutAndroid.d.ts | 11 ++++++++++- .../DrawerAndroid/DrawerLayoutAndroidTypes.js | 6 ++++++ packages/react-native/index.js | 6 ++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js index a2b98882a795..926fa7360f19 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js @@ -35,8 +35,12 @@ const DRAWER_STATES = ['Idle', 'Dragging', 'Settling'] as const; /** * React component that wraps the platform `DrawerLayout` (Android only). The Drawer (typically used for navigation) is rendered with `renderNavigationView` and direct children are the main view. The navigation view is initially not visible on the screen, but can be pulled in from the side of the window specified by the `drawerPosition` prop and its width can be set by the `drawerWidth` prop. * - * @see https://reactnative.dev/docs/drawerlayoutandroid + * DrawerLayoutAndroid is deprecated and will be removed in a future release. + * Use `react-native-drawer-layout` instead. + * + * @see https://reactnavigation.org/docs/drawer-layout/ * @platform android + * @deprecated */ class DrawerLayoutAndroid extends React.Component diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts index 2f2e08efc1e2..26fdec88e432 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts @@ -21,7 +21,10 @@ export interface DrawerSlideEvent extends NativeSyntheticEvent {} /** - * @see DrawerLayoutAndroid.android.js + * DrawerLayoutAndroid is deprecated and will be removed in a future release. + * Use `react-native-drawer-layout` instead. + * @see https://reactnavigation.org/docs/drawer-layout/ + * @deprecated */ export interface DrawerLayoutAndroidProps extends ViewProps { /** @@ -123,6 +126,12 @@ interface DrawerPosition { declare class DrawerLayoutAndroidComponent extends React.Component {} declare const DrawerLayoutAndroidBase: Constructor & typeof DrawerLayoutAndroidComponent; +/** + * DrawerLayoutAndroid is deprecated and will be removed in a future release. + * Use `react-native-drawer-layout` instead. + * @see https://reactnavigation.org/docs/drawer-layout/ + * @deprecated + */ export class DrawerLayoutAndroid extends DrawerLayoutAndroidBase { /** * drawer's positions. diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js index d7f7df9c8004..c5b16a13e090 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js @@ -27,6 +27,12 @@ export type DrawerSlideEvent = NativeSyntheticEvent< }>, >; +/** + * DrawerLayoutAndroid is deprecated and will be removed in a future release. + * Use `react-native-drawer-layout` instead. + * @see https://reactnavigation.org/docs/drawer-layout/ + * @deprecated + */ export type DrawerLayoutAndroidProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 69c3f67ca8b1..9afcc564f721 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -39,6 +39,12 @@ module.exports = { return require('./Libraries/Components/Button').default; }, get DrawerLayoutAndroid() { + warnOnce( + 'drawer-layout-android-deprecated', + 'DrawerLayoutAndroid is deprecated and will be removed in a future release. ' + + "Use 'react-native-drawer-layout' instead. " + + 'See https://reactnavigation.org/docs/drawer-layout/', + ); return require('./Libraries/Components/DrawerAndroid/DrawerLayoutAndroid') .default; },