-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
90 lines (80 loc) · 2.75 KB
/
App.js
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
import { StatusBar } from "expo-status-bar";
import { useFonts } from "expo-font";
import { StyleSheet, View } from "react-native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import NavigationProvider from "./context/navigationContext";
import { BottomNavigation, LoadingScreen } from "./App/components";
import fonts from "./assets/fonts";
import Home from "./App/screens/Home";
import Search from "./App/screens/Search";
import Saved from "./App/screens/Saved";
import Profile from "./App/screens/Profile";
import OrderScreen from "./App/screens/Order/OrderScreen";
import CartProvider from "./context/cartContext";
import MapScreen from "./App/screens/MapScreen/MapScreen";
const Stack = createNativeStackNavigator();
const MainStack = createNativeStackNavigator();
const OrderStack = createNativeStackNavigator();
const screenOptions = {
headerShown: false,
};
const orderScreenOption = {
headerShown: false,
animation: "slide_from_bottom",
animationDuration: 600,
};
export default function App() {
const [fontsLoaded] = useFonts({ ...fonts.poppins });
if (fontsLoaded)
return (
<>
<StatusBar style="dark" translucent />
<NavigationProvider>
<Stack.Navigator screenOptions={screenOptions}>
<Stack.Screen name="main" component={Main} />
<Stack.Screen name="order" component={Order} options={orderScreenOption} />
</Stack.Navigator>
</NavigationProvider>
</>
);
return <LoadingScreen />;
}
function Main() {
return (
<View style={styles.flex}>
<MainStack.Navigator screenOptions={screenOptions}>
<MainStack.Screen name="home" component={Home} />
<MainStack.Screen name="search" component={Search} />
<MainStack.Screen name="saved" component={Saved} />
<MainStack.Screen name="profile" component={Profile} />
</MainStack.Navigator>
<BottomNavigation />
</View>
);
}
const orderNestedScreenOptions = {
headerShown: false,
};
function Order() {
return (
<CartProvider>
<OrderStack.Navigator>
<OrderStack.Screen
name="orderScreen"
component={OrderScreen}
options={orderNestedScreenOptions}
/>
<OrderStack.Screen
name="mapScreen"
component={MapScreen}
options={orderNestedScreenOptions}
/>
</OrderStack.Navigator>
</CartProvider>
);
}
const styles = StyleSheet.create({
flex: {
flex: 1,
},
});