-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
58 lines (55 loc) · 1.87 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
import { ApolloProvider } from "@apollo/client";
import AppLoading from "expo-app-loading";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import widlarzClient from "./lib/api";
import { UserProvider } from "./utils/contexts/User";
import { useLoadFonts } from "./utils/hooks/loadFonts";
import Rooms from "./views/Rooms";
import Chat from "./views/Chat";
import LogIn from "./views/LogIn";
import SignUp from "./views/SignUp";
import { HeaderProvider } from "./utils/contexts/Header";
import Header from "./components/Header";
const disableHeader = { header: () => null };
export default function App() {
const fontsLoaded = useLoadFonts();
if (!fontsLoaded) return <AppLoading />;
const Stack = createNativeStackNavigator<ParamList>();
return (
<ApolloProvider client={widlarzClient}>
<HeaderProvider>
<UserProvider>
<NavigationContainer>
<Stack.Navigator initialRouteName="LogIn">
<Stack.Screen
name="Rooms"
component={Rooms}
options={{
header: ({ route }) => <Header title={route.name} />,
}}
/>
<Stack.Screen
name="Chat"
component={Chat}
options={{
header: ({ route }) => <Header title={route.name} />,
}}
/>
<Stack.Screen
name="LogIn"
component={LogIn}
options={disableHeader}
/>
<Stack.Screen
name="SignUp"
component={SignUp}
options={disableHeader}
/>
</Stack.Navigator>
</NavigationContainer>
</UserProvider>
</HeaderProvider>
</ApolloProvider>
);
}