Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Tushant
Created August 15, 2017 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tushant/70c67a5ca3cf99623cdc6e90492947a4 to your computer and use it in GitHub Desktop.
Save Tushant/70c67a5ca3cf99623cdc6e90492947a4 to your computer and use it in GitHub Desktop.
import { StackNavigator, DrawerNavigator, TabNavigator } from 'react-navigation';
import MyHomeScreen from '../Home';
import Profile from '../Profile';
import Settings from '../Settings';
import Imp from '../Imp';
const TouchableImage = props =>
<TouchableOpacity onPress={props.onPress}>
{/* <Image source={props.source} /> */}
</TouchableOpacity>;
const StackView = StackNavigator({
Tabs: {
screen: TabNav
}
});
const TabNav = TabNavigator({
Home: {
screen: MyHomeScreen
},
Settings: {
screen: Settings
}
});
const drawerMenus = [
{
name: 'Home',
route: 'Home',
icon: 'ios-home-outline'
},
{
name: 'Profile',
route: 'Profile',
icon: 'ios-person'
},
{
name: 'Imp',
route: 'Imp',
icon: 'ios-person'
}
];
class DrawerView extends React.Component {
render() {
const { navigation } = this.props;
const drawerMenu = drawerMenus.map(menu => {
return (
<TouchableOpacity key={menu.name} onPress={() => navigation.navigate(menu.route)}>
<Text
style={{
fontSize: 16,
marginBottom: 10,
paddingRight: 10,
color: '#7C7877'
}}
>
<Icon name={menu.icon} size={30} color="#7C7877" margin="10px 20px" />
{menu.name}
</Text>
</TouchableOpacity>
);
});
return (
<View>
<View style={{ backgroundColor: 'red', padding: 100 }} />
<View
style={{
padding: 10
}}
>
{drawerMenu}
</View>
</View>
);
}
}
const DrawerStack = DrawerNavigator(
{
Home: {
screen: StackView
}
},
{
contentComponent: DrawerView,
drawerWidth: 280
}
);
export default DrawerStack;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment