-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
72 lines (61 loc) · 1.8 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { AppLoading } from 'expo';
import * as Font from 'expo-font';
import React, { useState } from 'react';
import { PortalProvider } from 'react-native-portal'
import { LinearGradient } from 'expo-linear-gradient'
// REDUX
import { Provider } from 'react-redux'
import configureStore from 'core/store'
// PERSIST
import { PersistGate } from 'redux-persist/integration/react'
import {
Platform, StatusBar,
} from 'react-native';
import AppNavigator from './app/Navigator';
async function loadResourcesAsync() {
await Promise.all([
Font.loadAsync({
roboto: require('./assets/fonts/Roboto-Regular.ttf'),
'roboto-300': require('./assets/fonts/Roboto-Light.ttf'),
'roboto-500': require('./assets/fonts/Roboto-Medium.ttf'),
'roboto-600': require('./assets/fonts/Roboto-Bold.ttf'),
}),
]);
}
function handleLoadingError(error: Error) {
console.warn(error);
}
function handleFinishLoading(setLoadingComplete) {
setLoadingComplete(true);
}
const { store, persistor } = configureStore()
export default function App({ skipLoadingScreen }) {
const [isLoadingComplete, setLoadingComplete] = useState(false);
if (!isLoadingComplete && !skipLoadingScreen) {
return (
<AppLoading
startAsync={loadResourcesAsync}
onError={handleLoadingError}
onFinish={() => handleFinishLoading(setLoadingComplete)}
/>
);
}
// <PersistGate loading={null} persistor={persistor}>
// <AppNavigator />
// </PersistGate>
return (
<LinearGradient
style={{ flex: 1 }}
colors={['#99D815', '#49C0DC']}
start={[0, 0]}
end={[1, 1]}
>
<StatusBar animated barStyle="light-content" />
<Provider store={store}>
<PortalProvider>
<AppNavigator />
</PortalProvider>
</Provider>
</LinearGradient>
);
}