-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
46 lines (41 loc) · 1.24 KB
/
App.js
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
import React, {useState, useEffect, useContext} from "react"
import { LogBox } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import {Provider as RestaurantsProvider} from "./src/context/RestaurantsContext";
import {Provider as OrdersProvider} from "./src/context/OrdersContext";
import {Provider as AuthProvider} from "./src/context/AuthContext";
import AuthContext from "./src/context/AuthContext";
import DrawerNavigator from "./src/navigations/DrawerNav";
import { AuthScreen, Welcome } from "./src/screens";
const App = () => {
const [modalVisible, setModalVisible] = useState(false);
const {authState: {Authenticated}} = useContext(AuthContext);
LogBox.ignoreLogs(['Sending']);
useEffect(() => {
setModalVisible(true)
setTimeout(() => {
setModalVisible(false)
}, 2500);
}, [])
return <>
{
modalVisible ? <Welcome visible={modalVisible} />
: <NavigationContainer>
<>
{
!Authenticated ? <AuthScreen /> : <DrawerNavigator />
}
</>
</NavigationContainer>
}
</>
}
export default () => (
<AuthProvider>
<RestaurantsProvider>
<OrdersProvider>
<App />
</OrdersProvider>
</RestaurantsProvider>
</AuthProvider>
);