17
Add option to hide item from a Drawer
closed
Martin Gajdičiar
In previous versions, it was possible to hide drawer item from the drawer by setting its label to null:
drawerLabel: () => null
as seen e.g. in https://github.com/react-navigation/react-navigation/issues/2021#issuecomment-485753308
With v5 it is no possible anymore. Declaring screen like this:
<Drawer.Screen
name="Hidden route"
component={HiddenScreen}
options={() => ({
drawerLabel: () => null,
title: undefined,
drawerIcon: () => null,
})}
/>
still renders the item in the drawer. It has no title, but the container is there and is touchable.
It would be great to have an option to hide the drawer item from the drawer.
This issues was mentioned here https://github.com/react-navigation/react-navigation/issues/6753
Activity Feed
Sort by
satya164
closed
This is already possible using the
drawerItemStyle
option https://reactnavigation.org/docs/drawer-navigator/#draweritemstylee.g.
drawerItemStyle: { display: none }
You also have complete freedom in how you want to render your drawer using
drawerContent
- and using the built-in components to reuse existing styling.https://reactnavigation.org/docs/drawer-navigator/#drawercontent
Shakil Ahmed
this is quite necessary for some common UI/UX practices, I have guest access in my app, and I find it more meaningful to put the login and sign up navigator at the very bottom of the drawer using a custom view, that part is easily doable, but now I can't get rid of the default drawer items for those two screens.

Shakil Ahmed
in case anyone ends up here, I found a workaround for this- https://github.com/react-navigation/react-navigation/issues/795#issuecomment-618771758