-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
73 lines (63 loc) · 2.04 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
import React, { useEffect, useState } from "react";
import { View, Text } from "react-native";
import { NavigationContainer, useNavigation } from "@react-navigation/native";
import { ApolloClient, InMemoryCache, ApolloProvider } from "@apollo/client";
import { persistCache } from "apollo3-cache-persist";
import { LocalizationProvider } from "@mui/x-date-pickers";
import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
import Portal, { Stack } from "./container/Portal";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { ThemeProvider, createTheme } from "@mui/material/styles";
import AuthenticatedStack from "./container/Portal";
import { helpers } from "./data/helpers";
import { useAuthState } from "react-firebase-hooks/auth";
import { auth } from "./firebase";
import SignUpIn from "./pages/SignUpIn/SignUpIn";
const App = () => {
const cache = new InMemoryCache();
const client = new ApolloClient({
uri: "http://localhost:4000",
cache,
});
const cacheFix = async () => {
await persistCache({
cache,
storage: AsyncStorage,
});
};
useEffect(() => {
cacheFix();
}, []);
const darkTheme = createTheme({
palette: {
mode: "dark",
},
});
const [user] = useAuthState(auth);
return (
<ApolloProvider client={client}>
<ThemeProvider theme={darkTheme}>
<LocalizationProvider dateAdapter={AdapterMoment}>
<NavigationContainer>
<Stack.Navigator
initialRouteName="CreateEvent"
screenOptions={{
headerShown: false,
}}
>
{user ? (
<Stack.Screen
name="AuthenticatedStack"
component={AuthenticatedStack}
/>
) : (
<Stack.Screen name="SignUpIn" component={SignUpIn} />
)}
</Stack.Navigator>
</NavigationContainer>
</LocalizationProvider>
</ThemeProvider>
</ApolloProvider>
);
};
export default App;