hide on drawer react navigation code example
Example 1: hide screen links in drawerNavigation in react native
export default props => {
const { state, ...rest } = props;
const newState = { ...state}
newState.routes = newState.routes.filter(item => item.name !== 'Login')
return (
<DrawerContentScrollView {...props}>
<DrawerItemList state={newState} {...rest} />
</DrawerContentScrollView>
)
}
Example 2: 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}
/>
);