mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Deprecate DrawerLayoutAndroid (#57397)
Summary: Deprecates `DrawerLayoutAndroid` as part of the effort to keep core lean. It is Android only, and `react-native-drawer-layout` is a better, cross-platform alternative. This adds a `deprecated` JSDoc tag to the component and its props (Flow and TypeScript) and a one-time runtime warning when the component is imported, pointing users to `react-native-drawer-layout`. No behavior changes. ## Changelog: [ANDROID] [DEPRECATED] - Deprecate `DrawerLayoutAndroid`, use `react-native-drawer-layout` instead Pull Request resolved: https://github.com/react/react-native/pull/57397 Test Plan: - `deprecated` shows a strikethrough on `DrawerLayoutAndroid` in editors. - Importing/rendering `DrawerLayoutAndroid` logs the deprecation warning once, pointing to `react-native-drawer-layout`. Reviewed By: javache Differential Revision: D110334227 Pulled By: Abbondanzo fbshipit-source-id: 40edd2a4e997ba3ab350c7b7229beb237e83a57b
This commit is contained in:
1 parent
721b1cfcac
commit
5c5e6cd8ce
4 files changed
+32
-2
No files matched your search
+5
-1
@@ -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<DrawerLayoutAndroidProps, DrawerLayoutAndroidState>
|
||||
|
||||
+10
-1
@@ -21,7 +21,10 @@ export interface DrawerSlideEvent
|
||||
extends NativeSyntheticEvent<NativeTouchEvent> {}
|
||||
|
||||
/**
|
||||
* @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<DrawerLayoutAndroidProps> {}
|
||||
declare const DrawerLayoutAndroidBase: Constructor<HostInstance> &
|
||||
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.
|
||||
|
||||
+6
@@ -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,
|
||||
|
||||
|
||||
Vendored
+11
@@ -38,7 +38,18 @@ module.exports = {
|
||||
get Button() {
|
||||
return require('./Libraries/Components/Button').default;
|
||||
},
|
||||
/**
|
||||
* @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/
|
||||
*/
|
||||
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;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user