-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
53 lines (46 loc) · 1.58 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
import "react-native-gesture-handler";
import React from "react";
import { AuthContextProvider, useAuthContext } from "./src/context/AuthContext";
import { AuthStackScreens } from "./src/router/stacks/AuthStackScreens";
import { DrawerStackScreens } from "./src/router/stacks/DrawerStackScreens";
import { NavigationContainer } from "@react-navigation/native";
import { View } from "react-native";
import { RouteContextProvider } from "./src/context/RouteContext";
import { StatusBar } from "expo-status-bar";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import * as NavigationBar from "expo-navigation-bar";
function App() {
const { isLoggedIn } = useAuthContext();
const greyBackgroundColor = () =>
NavigationBar.setBackgroundColorAsync("rgba(37, 37, 37, 1)");
const blackBackgroundColor = () =>
NavigationBar.setBackgroundColorAsync("rgba(14, 13, 11, 1)");
isLoggedIn ? greyBackgroundColor() : blackBackgroundColor();
const renderStack = () => {
return isLoggedIn ? (
<RouteContextProvider>
<DrawerStackScreens />
</RouteContextProvider>
) : (
<AuthStackScreens />
);
};
const queryClient = new QueryClient();
return (
<>
<StatusBar style="light" />
<QueryClientProvider client={queryClient}>
<NavigationContainer>{renderStack()}</NavigationContainer>
</QueryClientProvider>
</>
);
}
export default function AppContainer() {
return (
<View style={{ flex: 1, backgroundColor: "black" }}>
<AuthContextProvider>
<App />
</AuthContextProvider>
</View>
);
}