Skip to content

Instantly share code, notes, and snippets.

Created October 8, 2017 17:13
Show Gist options
  • Save anonymous/ca8491a4d6f81efb7f7410da7bafc237 to your computer and use it in GitHub Desktop.
Save anonymous/ca8491a4d6f81efb7f7410da7bafc237 to your computer and use it in GitHub Desktop.
// đây là file App.js
import React, {Component} from 'react';
import {View, Text, Navigator, StatusBar} from 'react-native';
import SideMenu from './Router.js'
import Authentication from './Authentication/Authentication.js';
import Main from './Main/Main.js';
import ChangeInfo from './ChangeInfo/ChangeInfo.js';
import OrderHistory from './OrderHistory/OrderHistory.js';
export default class App extends Component {
render() {
return(
<SideMenu />
);
}
}
//Đây là file Router.js
import React from 'react';
import { Dimensions } from 'react-native';
import { StackNavigator, TabNavigator, DrawerNavigator, ScrollView } from 'react-navigation';
import Authentication from './Authentication/Authentication';
import ChangeInfo from './ChangeInfo/ChangeInfo';
import Main from './Main/Main';
import OrderHistory from './OrderHistory/OrderHistory';
import Home from './Main/Shop/Home/Home.js';
import Cart from './Main/Shop/Cart/Cart.js';
import Search from './Main/Shop/Search/Search.js';
import Contact from './Main/Shop/Contact/Contact.js';
import Menu from './Main/Menu.js';
const { width } = Dimensions.get('window');
export const HomeStack = StackNavigator({
Main_Screen: {
screen: Main
},
Authentication_Screen: {
screen: Authentication
},
ChangeInfo_Screen: {
screen: ChangeInfo
},
OrderHistory_Screen: {
screen: OrderHistory
}
},
{
headerMode: 'none',
navigationOptions: {
headerVisible: false,
}
}
)
export const CartStack = StackNavigator({
Cart_Screen: {
screen: Cart
}
},
{
headerMode: 'none',
navigationOptions: {
headerVisible: false,
}
}
)
export const SearchStack = StackNavigator({
Search_Screen: {
screen: Search
}
},
{
headerMode: 'none',
navigationOptions: {
headerVisible: false,
}
}
)
export const ContactStack = StackNavigator({
Contact_Screen: {
screen: Contact
}
},
{
headerMode: 'none',
navigationOptions: {
headerVisible: false,
}
}
)
export const Tabbar = TabNavigator({
HomeStack_Screen: {
screen: HomeStack,
navigationOptions: {
title: 'Home'
}
},
CartStack_Screen: {
screen: CartStack,
navigationOptions: {
title: 'Cart'
}
},
SearchStack_Screen: {
screen: SearchStack,
navigationOptions: {
title: 'Search'
}
},
ContactStack_Screen: {
screen: ContactStack,
navigationOptions: {
title: 'Contact'
}
},
},
{
tabBarPosition: 'bottom'
}
);
export default SideMenu = DrawerNavigator({
Tabbar_Screen: { screen: Tabbar }
},
{
drawerWidth: width * 0.75,
drawerPosition: 'left',
contentComponent: props => <Menu {...props} />
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment