-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
60 lines (47 loc) · 1.46 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
import React, {useState} from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { LogBox } from "react-native";
import RootStack from './app/navigators/RootStack';
import { userContext } from './app/Context/userContext';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { ToastProvider } from 'react-native-toast-notifications';
export default function App() {
const ignoreWarns = [
"Setting a timer for a long period of time",
"VirtualizedLists should never be nested inside plain ScrollViews with the same orientation",
"ViewPropTypes will be removed",
"AsyncStorage has been extracted from react-native",
"EventEmitter.removeListener",
];
const warn = console.warn;
console.warn = (...arg) => {
for (let i = 0; i < ignoreWarns.length; i++) {
if (arg[0].startsWith(ignoreWarns[i])) return;
}
warn(...arg);
};
LogBox.ignoreLogs(ignoreWarns);
const [UserId, setUserId] = useState("");
const [loading, setLoading] = useState(true);
const checkLoggedIn = () => {
AsyncStorage
.getItem('id')
.then((result) =>{
if(result != null){
setUserId(result);
}else{
setUserId(null);
}
})
.catch((error) => {
console.log(error);
})
}
return (
<ToastProvider>
<userContext.Provider value={{UserId, setUserId, loading, setLoading}}>
< RootStack/>
</userContext.Provider>
</ToastProvider>
);
}