-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathApp.tsx
134 lines (125 loc) · 3.58 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import { StatusBar } from "expo-status-bar";
import React from "react";
import { Image, StyleSheet, Text, View } from "react-native";
import { HomeScreen } from "./src/screens/HomeScreen";
import { LandingScreen } from "./src/screens/LandingScreen";
import { Provider } from "react-redux";
import { store } from "./src/redux";
import { createAppContainer, createSwitchNavigator } from "react-navigation";
import { createStackNavigator } from "react-navigation-stack";
import { createBottomTabNavigator } from "react-navigation-tabs";
import { SearchScreen } from "./src/screens/SearchScreen";
import { RestaurantScreen } from "./src/screens/RestaurantScreen";
import { FoodDetailScreen } from "./src/screens/FoodDetailScreen";
import { CartScreen } from "./src/screens/CartScreen";
import { LoginScreen } from "./src/screens/LoginScreen";
const switchNavigator = createSwitchNavigator({
landingStack: {
screen: createStackNavigator(
{
Landing: LandingScreen,
// search address screen
},
{
defaultNavigationOptions: {
headerShown: false,
},
}
),
},
homeStack: createBottomTabNavigator({
// Home tab Icon
home: {
screen: createStackNavigator(
{
HomePage: HomeScreen,
SearchPage: SearchScreen,
RestaurantPage: RestaurantScreen,
FoodDetailPage: FoodDetailScreen,
},
{
defaultNavigationOptions: {
headerShown: false,
},
}
),
navigationOptions: {
tabBarIcon: ({ focused, tintColor }) => {
let icon =
focused == true
? require("./src/images/home_icon.png")
: require("./src/images/home_n_icon.png");
return <Image source={icon} style={styles.tabIcon} />;
},
},
},
// Home tab Icon
Offer: {
screen: createStackNavigator({
OfferPage: HomeScreen, //
}),
navigationOptions: {
tabBarIcon: ({ focused, tintColor }) => {
let icon =
focused == true
? require("./src/images/offer_icon.png")
: require("./src/images/offer_n_icon.png");
return <Image source={icon} style={styles.tabIcon} />;
},
},
},
// Home tab Icon
Cart: {
screen: createStackNavigator(
{
CartPage: CartScreen,
LoginPage: LoginScreen,
},
{
defaultNavigationOptions: {
headerShown: false,
},
}
),
navigationOptions: {
tabBarIcon: ({ focused, tintColor }) => {
let icon =
focused == true
? require("./src/images/cart_icon.png")
: require("./src/images/cart_n_icon.png");
return <Image source={icon} style={styles.tabIcon} />;
},
},
},
// Home tab Icon
Account: {
screen: createStackNavigator({
AccountPage: HomeScreen,
LoginPage: LoginScreen,
}),
navigationOptions: {
tabBarIcon: ({ focused, tintColor }) => {
let icon =
focused == true
? require("./src/images/account_icon.png")
: require("./src/images/account_n_icon.png");
return <Image source={icon} style={styles.tabIcon} />;
},
},
},
}),
});
const AppNavigation = createAppContainer(switchNavigator);
export default function App() {
return (
<Provider store={store}>
<AppNavigation />
</Provider>
);
}
const styles = StyleSheet.create({
tabIcon: {
width: 30,
height: 30,
},
});