-
Notifications
You must be signed in to change notification settings - Fork 7
/
App.tsx
54 lines (44 loc) · 1.49 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
import { StatusBar } from 'expo-status-bar';
import { LogBox, StyleSheet } from 'react-native';
import React, { useEffect, FC, useState } from 'react';
import polyfill from '@amityco/react-native-formdata-polyfill';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import Navigation from 'routes';
import { CreateClient } from 'components';
import useCachedResources from 'hooks/useCachedResources';
import { AuthContextProvider } from 'providers/auth-provider';
import { PreferencesContextProvider } from 'providers/preferences-provider';
import Theme from './Theme';
polyfill();
const App: FC = () => {
const isLoadingComplete = useCachedResources();
const [showCreateClient, setShowCreateClient] = useState(true);
useEffect(() => {
LogBox.ignoreLogs(['Animated: `useNativeDriver`']);
}, []);
if (!isLoadingComplete) {
return null;
}
return (
<GestureHandlerRootView style={styles.root}>
<SafeAreaProvider>
<PreferencesContextProvider>
<AuthContextProvider>
<Theme>
<Navigation />
<StatusBar />
</Theme>
</AuthContextProvider>
{showCreateClient && <CreateClient onClose={() => setShowCreateClient(false)} />}
</PreferencesContextProvider>
</SafeAreaProvider>
</GestureHandlerRootView>
);
};
const styles = StyleSheet.create({
root: {
flex: 1,
},
});
export default App;