-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.js
91 lines (84 loc) · 2.98 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
import "./polyfills";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { NavigationContainer } from "@react-navigation/native";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useFonts } from "expo-font";
import * as Linking from "expo-linking";
import * as React from "react";
import "react-native-gesture-handler";
import { PaperProvider } from "react-native-paper";
import "react-native-url-polyfill/auto";
import { LoginHandler } from "./authentication/LoginHandler";
import { WixSessionProvider } from "./authentication/session";
import { LoadingIndicator } from "./components/LoadingIndicator/LoadingIndicator";
import { TabBar } from "./components/Tabs/Tabs";
import { tabs } from "./data/tabs/data";
const Tab = createBottomTabNavigator();
const queryClient = new QueryClient();
function App() {
const [fontsLoaded] = useFonts({
"Fraunces-Regular": require("./assets/fonts/static/Fraunces_144pt-Regular.ttf"),
"Fraunces-Bold": require("./assets/fonts/static/Fraunces_144pt-Bold.ttf"),
});
if (!fontsLoaded) {
return <LoadingIndicator />;
}
const clientId = process.env.EXPO_PUBLIC_WIX_CLIENT_ID || "";
return (
<PaperProvider>
<QueryClientProvider client={queryClient}>
<WixSessionProvider clientId={clientId}>
<LoginHandler>
<NavigationContainer
linking={{
prefixes: [Linking.createURL("/")],
config: {
screens: {
Store: {
path: "store",
screens: {
CheckoutThankYou: "checkout/thank-you",
Cart: "cart",
Products: "products",
Product: "products/product",
Collections: "collections",
},
},
},
},
}}
>
<Tab.Navigator
screenOptions={() => ({
headerShown: false,
tabBarLabelStyle: {
fontSize: 11,
},
tabBarStyle: {
backgroundColor: "#C4C197",
},
tabBarHideOnKeyboard: true,
})}
initialRouteName={tabs[0].name}
tabBar={(props) => <TabBar {...props} />}
>
{tabs.map((tab) => (
<Tab.Screen
options={{
tabBarIcon: tab.icon,
}}
name={tab.name}
component={tab.component}
navigationKey={tab.name}
key={tab.name}
/>
))}
</Tab.Navigator>
</NavigationContainer>
</LoginHandler>
</WixSessionProvider>
</QueryClientProvider>
</PaperProvider>
);
}
export default App;