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 (where your content goes). 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.
Inherits View Props.
drawerBackgroundColorSpecifies the background color of the drawer. The default value is white. If you want to set the opacity of the drawer, use rgba. Example:
return ( <DrawerLayoutAndroid drawerBackgroundColor="rgba(0,0,0,0.5)" /> );
| Type | Required |
|---|---|
| color | No |
drawerLockModeSpecifies the lock mode of the drawer. The drawer can be locked in 3 states:
openDrawer/closeDrawer).| Type | Required |
|---|---|
| enum('unlocked', 'locked-closed', 'locked-open') | No |
drawerPositionSpecifies the side of the screen from which the drawer will slide in. By default it is set to left.
| Type | Required |
|---|---|
| enum('left', 'right') | No |
drawerWidthSpecifies the width of the drawer, more precisely the width of the view that be pulled in from the edge of the window.
| Type | Required |
|---|---|
| number | No |
keyboardDismissModeDetermines whether the keyboard gets dismissed in response to a drag.
| Type | Required |
|---|---|
| enum('none', 'on-drag') | No |
onDrawerCloseFunction called whenever the navigation view has been closed.
| Type | Required |
|---|---|
| function | No |
onDrawerOpenFunction called whenever the navigation view has been opened.
| Type | Required |
|---|---|
| function | No |
onDrawerSlideFunction called whenever there is an interaction with the navigation view.
| Type | Required |
|---|---|
| function | No |
onDrawerStateChangedFunction called when the drawer state has changed. The drawer can be in 3 states:
| Type | Required |
|---|---|
| function | No |
renderNavigationViewThe navigation view that will be rendered to the side of the screen and can be pulled in.
| Type | Required |
|---|---|
| function | Yes |
statusBarBackgroundColorMake the drawer take the entire screen and draw the background of the status bar to allow it to open over the status bar. It will only have an effect on API 21+.
| Type | Required |
|---|---|
| color | No |
closeDrawer()closeDrawer();
Closes the drawer.
openDrawer()openDrawer();
Opens the drawer.
© 2022 Facebook Inc.
Licensed under the Creative Commons Attribution 4.0 International Public License.
https://reactnative.dev/docs/drawerlayoutandroid