-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp2.js
49 lines (38 loc) · 1.26 KB
/
App2.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
import React, { useState, useEffect } from 'react';
import { NativeModules } from 'react-native';
import { createStore, applyMiddleware, compose } from 'redux';
import { Provider } from 'react-redux';
import ReduxThunk from 'redux-thunk';
import { AppLoading } from 'expo';
import * as Font from 'expo-font';
import rootReducer from './reducers';
if (__DEV__) {
import('./ReactotronConfig').then(() => console.log('Reactotron Configured'));
NativeModules.DevSettings.setIsDebuggingRemotely(true);
}
import MainNavigator from './navigators/MainNavigator';
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(rootReducer, composeEnhancer(applyMiddleware(ReduxThunk)));
const App = () => {
const [fontLoaded, setFontLoaded] = useState(false);
useEffect(() => {
console.disableYellowBox = true;
const fetchFonts = async () => {
await Font.loadAsync({
bodyfont: require('./assets/fonts/Roboto-Regular.ttf'),
headerfont: require('./assets/fonts/Roboto-Bold.ttf'),
});
setFontLoaded(true);
};
fetchFonts();
}, []);
if (!fontLoaded) {
return <AppLoading />;
}
return (
<Provider store={store}>
<MainNavigator />
</Provider>
);
};
export default App;