-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
154 lines (146 loc) · 6.55 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import "react-native-gesture-handler";
import { enableScreens } from "react-native-screens";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import { useEffect } from "react";
import Toast from "react-native-toast-message";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { BottomSheetModalProvider } from "@gorhom/bottom-sheet";
import ErrorBoundary from "./screens_options/ErrorBoundary";
import { AuthProvider } from "./components/auth/AuthContext";
import { CartProvider } from "./contexts/CartContext";
import { WishProvider } from "./contexts/WishContext";
import {
chatScreenOptions,
systemScreenOptions,
successScreenOptions,
AboutScreenOptions,
} from "./screens_options/AppHeaderOptions";
import {
Cart,
OrderDetails,
ProductDetails,
Products,
OrderSuccess,
LoginPage,
Favourites,
Orders,
Register,
Categories,
Checkout,
UserDetails,
MessageCenter,
Help,
About,
Faqs,
Home,
SystemMessages,
InventoryDashboard,
AddProduct,
EditProductList,
StaffSettings,
EditProduct,
EditCategoriesList,
AddCategory,
EditCategory,
PreviewProduct,
} from "./screens";
import BottomTabNavigation from "./navigation/BottomTabNavigation";
import InventoryTabNavigation from "./navigation/InventoryTabNavigation";
import BrokenComponent from "./screens_options/BrokenComponent";
enableScreens();
const Stack = createNativeStackNavigator();
export default function App() {
const [fontsLoaded] = useFonts({
bold: require("./assets/fonts/Outfit/Outfit-Bold.ttf"),
extrabold: require("./assets/fonts/Outfit/Outfit-ExtraBold.ttf"),
light: require("./assets/fonts/Outfit/Outfit-Light.ttf"),
medium: require("./assets/fonts/Outfit/Outfit-Medium.ttf"),
semibold: require("./assets/fonts/Outfit/Outfit-SemiBold.ttf"),
regular: require("./assets/fonts/Outfit/Outfit-Regular.ttf"),
thin: require("./assets/fonts/Outfit/Outfit-Thin.ttf"),
GtAlpine: require("./assets/fonts/GT-Alpina-Light-Italic.ttf"),
});
useEffect(() => {
const prepare = async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
};
prepare();
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<ErrorBoundary>
<GestureHandlerRootView style={{ flex: 1 }}>
<BottomSheetModalProvider>
<AuthProvider>
<CartProvider>
<WishProvider>
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="Bottom Navigation"
component={BottomTabNavigation}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Inventory Navigation"
component={InventoryTabNavigation}
options={{ headerShown: false }}
/>
<Stack.Screen
name="EditCategoriesList"
component={EditCategoriesList}
options={{ headerShown: false }}
/>
<Stack.Screen name="Home" component={Home} options={{ headerShown: false }} />
<Stack.Screen name="EditCategory" component={EditCategory} options={{ headerShown: false }} />
<Stack.Screen name="AddCategory" component={AddCategory} options={{ headerShown: false }} />
<Stack.Screen name="StaffSettings" component={StaffSettings} options={{ headerShown: false }} />
<Stack.Screen
name="EditProductsList"
component={EditProductList}
options={{ headerShown: false }}
/>
<Stack.Screen name="PreviewProduct" component={PreviewProduct} options={{ headerShown: false }} />
<Stack.Screen name="EditProduct" component={EditProduct} options={{ headerShown: false }} />
<Stack.Screen name="Add Product" component={AddProduct} options={{ headerShown: false }} />
<Stack.Screen name="Login" component={LoginPage} options={{ headerShown: false }} />
<Stack.Screen name="ProductDetails" component={ProductDetails} options={{ headerShown: false }} />
<Stack.Screen name="ProductList" component={Products} options={{ headerShown: false }} />
<Stack.Screen name="Favourites" component={Favourites} options={{ headerShown: false }} />
<Stack.Screen name="Categories" component={Categories} options={{ headerShown: true }} />
<Stack.Screen name="Cart" component={Cart} options={{ headerShown: false }} />
<Stack.Screen name="Checkout" component={Checkout} options={{ headerShown: false }} />
<Stack.Screen name="Orders" component={Orders} options={{ headerShown: false }} />
<Stack.Screen name="Register" component={Register} options={{ headerShown: false }} />
<Stack.Screen name="UserDetails" component={UserDetails} options={{ headerShown: false }} />
<Stack.Screen name="Message" component={MessageCenter} options={{ headerShown: false }} />
<Stack.Screen name="Help" component={Help} options={chatScreenOptions} />
<Stack.Screen name="About" component={About} options={{ headerShown: false }} />
<Stack.Screen name="Faqs" component={Faqs} options={{ headerShown: false }} />
<Stack.Screen name="SystemMessages" component={SystemMessages} options={systemScreenOptions} />
<Stack.Screen name="OrderSuccess" component={OrderSuccess} options={{ headerShown: false }} />
<Stack.Screen name="OrderDetails" component={OrderDetails} options={{ headerShown: false }} />
<Stack.Screen
name="InventoryDashboard"
component={InventoryDashboard}
options={{ headerShown: false }}
/>
</Stack.Navigator>
<Toast />
{/* <BrokenComponent /> */}
</NavigationContainer>
</WishProvider>
</CartProvider>
</AuthProvider>
</BottomSheetModalProvider>
</GestureHandlerRootView>
</ErrorBoundary>
);
}