-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.jsx
48 lines (42 loc) · 1.25 KB
/
App.jsx
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React from 'react';
import { Provider } from 'react-redux';
import { persistStore } from 'redux-persist';
import { PersistGate } from 'redux-persist/lib/integration/react';
import { Image } from 'react-native';
import FastImage from 'react-native-fast-image';
import AppNavigator from './navigator';
import store from './store';
import * as NavigationService from './services/navigationService';
import logos from './consts/Logos';
const persistor = persistStore(store);
class App extends React.Component {
navigator = null;
componentDidMount() {
// eslint-disable-next-line
const fetchableImages = Object.values(logos).map((logo) => ({ uri: isNaN(logo) ? logo : Image.resolveAssetSource(logo).uri }));
FastImage.preload(fetchableImages);
}
render() {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<AppNavigator ref={(ref) => {
if (!this.navigator) {
this.navigator = ref;
NavigationService.setNavigator(this.navigator);
}
}}
/>
</PersistGate>
</Provider>
);
}
}
export default App;