forked from OpenManifest/openmanifest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
70 lines (61 loc) · 2.03 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
61
62
63
64
65
66
67
68
69
70
import 'react-native-gesture-handler';
import { StatusBar } from 'expo-status-bar';
import * as React from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Provider } from "react-redux";
import { PersistGate } from 'redux-persist/integration/react'
import { Provider as MaterialProvider, ActivityIndicator, ProgressBar } from "react-native-paper"
import { View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import Apollo from "./graphql/Apollo";
import { store, persistor, useAppSelector } from "./redux/store";
import useCachedResources from './hooks/useCachedResources';
import Notifications from './components/notifications/Notifications';
import LinkingConfiguration from './navigation/Routes';
import RootNavigator from "./navigation/RootNavigator";
function Content() {
const state = useAppSelector(state => state.global);
return (
<React.Suspense
fallback={
<View style={{ flex: 1, flexGrow: 1 }}>
<ProgressBar indeterminate color={state?.theme?.colors?.accent} visible />
</View>
}
>
<Apollo>
<MaterialProvider theme={state.theme}>
<SafeAreaProvider>
<NavigationContainer
linking={LinkingConfiguration}
theme={state.theme}>
<RootNavigator />
</NavigationContainer>
<StatusBar />
<Notifications />
</SafeAreaProvider>
</MaterialProvider>
</Apollo>
</React.Suspense>
)
}
export default function App() {
const isLoadingComplete = useCachedResources();
if (!isLoadingComplete) {
return null;
} else {
return (
<Provider store={store}>
<PersistGate
persistor={persistor}
loading={
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<ActivityIndicator size="large" />
</View>
}>
<Content />
</PersistGate>
</Provider>
);
}
}