-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
80 lines (74 loc) · 2.35 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
import { createStackNavigator } from "@react-navigation/stack";
import { NavigationContainer, DefaultTheme } from "@react-navigation/native";
import * as Font from "expo-font";
import { useState } from "react";
import AppContext from "./components/AppContext";
import {
Inter_900Black,
Inter_400Regular,
Inter_600SemiBold,
Montserrat_900Black,
Montserrat_900Black_Italic,
Montserrat_600SemiBold,
} from "@expo-google-fonts/dev";
import Home from "./screens/Home";
import GameDetails from "./screens/GameDetails";
import NewGame from "./screens/NewGame";
import ServeSelection from "./screens/ServeSelection";
import ScoreKeeper from "./screens/ScoreKeeper";
import Login from "./screens/Login";
import Signup from "./screens/Signup";
import { client } from "./services/auth/apolloClient";
import { ApolloProvider } from "@apollo/client";
export default function App() {
const [fontsLoaded] = Font.useFonts({
//prettier-ignore
Montserrat_900Black,
Montserrat_900Black_Italic,
Montserrat_600SemiBold,
Inter_900Black,
Inter_400Regular,
Inter_600SemiBold,
});
const [loggedInUser, setLoggedInUser] = useState<any>({
userName: "",
games: [],
_id: 0,
stats: { gamesPlayed: 0, avgContribution: 0, totalContribution: 0 },
});
const userData = {
loggedInUser,
setLoggedInUser,
};
if (!fontsLoaded) {
return null;
}
const Stack = createStackNavigator();
const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: "white",
},
};
return (
<ApolloProvider client={client}>
<AppContext.Provider value={userData}>
<NavigationContainer theme={theme}>
<Stack.Navigator
screenOptions={{ headerShown: false }}
initialRouteName="Home"
>
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="Signup" component={Signup} />
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="GameDetails" component={GameDetails} />
<Stack.Screen name="NewGame" component={NewGame} />
<Stack.Screen name="ServeSelection" component={ServeSelection} />
<Stack.Screen name="ScoreKeeper" component={ScoreKeeper} />
</Stack.Navigator>
</NavigationContainer>
</AppContext.Provider>
</ApolloProvider>
);
}