forked from glific/mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
39 lines (34 loc) · 1.14 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
import 'react-native-gesture-handler';
import React, { useState } from 'react';
import { StyleSheet, SafeAreaView, StatusBar } from 'react-native';
import { ApolloProvider } from '@apollo/client';
import useAppResources from './utils/useAppResources';
import AuthContext from './config/AuthContext';
import { client } from './config/apollo';
import Navigation from './navigations';
import { COLORS } from './constants';
export default function App() {
const [token, setToken] = useState(null);
const [org, setOrg] = useState(null);
const [user, setUser] = useState(null);
const [alert, setAlert] = useState(null);
const appIsReady = useAppResources(setToken, setOrg, setUser);
if (!appIsReady) {
return null;
}
return (
<AuthContext.Provider value={{ token, setToken, org, setOrg, user, setUser, alert, setAlert }}>
<ApolloProvider client={client}>
<SafeAreaView style={styles.container}>
<StatusBar backgroundColor={COLORS.primary400} />
<Navigation />
</SafeAreaView>
</ApolloProvider>
</AuthContext.Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});