-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
36 lines (30 loc) · 993 Bytes
/
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
import "react";
import { useColorScheme } from 'react-native';
import { PaperProvider } from "react-native-paper";
import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import { DarkTheme, LightTheme } from "./theme";
import { AuthProvider, useAuth } from "./contexts/AuthContext";
import { AuthNavigator, AppNavigator } from "./components/Navigation";
import { FirestoreProvider } from "./contexts/FirestoreContext";
export default function App() {
const colorScheme = useColorScheme();
const theme = colorScheme === 'dark' ? DarkTheme : LightTheme;
const RootNavigator = () =>
{ const {user} = useAuth();
return (
<NavigationContainer>
{user ? <AppNavigator/>:<AuthNavigator/>}
</NavigationContainer>
);
};
return (
<PaperProvider theme={theme}>
<AuthProvider>
<FirestoreProvider>
<RootNavigator/>
</FirestoreProvider>
</AuthProvider>
</PaperProvider>
);
}