react navigation add screen to drawer without showing code example
Example 1: set navigation drawer to open by default react native
<Drawer.Navigator
initialRouteName="Home"
openByDefault>
<Drawer.Screen name="Home" component={HomeScreen} />
<Drawer.Screen name="Notifications" component={NotificationsScreen} />
</Drawer.Navigator>
Example 2: hide screen links in drawerNavigation in react native
//custom drawer content
export default props => {
const { state, ...rest } = props;
const newState = { ...state} //copy from state before applying any filter. do not change original state
newState.routes = newState.routes.filter(item => item.name !== 'Login') //replace "Login' with your route name
return (
<DrawerContentScrollView {...props}>
<DrawerItemList state={newState} {...rest} />
</DrawerContentScrollView>
)
}
Example 3: hide screen links in drawerNavigation in react native
import { DrawerItems } from 'react-navigation';
const visibleItems = ['HomeScreen', 'SettingsScreen', 'HelpScreen'];
const getVisible = item => contains(item.key, visibleItems);
const getFilteredAndStyledItems = ({ items, ...other }) => (
<DrawerItems
items={filter(getVisible, items)}
{...other}
/>
);