-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
49 lines (40 loc) · 1.25 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
import React, { useState } from 'react';
import { StyleSheet, View, StatusBar } from 'react-native';
import { enableScreens } from 'react-native-screens';
import * as Font from 'expo-font';
import { AppLoading } from 'expo';
import MealsNavigator from './navigation/MealsNavigator';
import { createStore, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import MainReducer from './store/reducers/mainReducer';
enableScreens();
const rootReducer = combineReducers({
meals: MainReducer
});
const store = createStore(rootReducer);
const fetchFont = () => {
return Font.loadAsync({
'Raleway-Regular': require('./assets/fonts/Raleway-Regular.ttf'),
'Raleway-Medium': require('./assets/fonts/Raleway-Medium.ttf'),
'Raleway-Bold': require('./assets/fonts/Raleway-Bold.ttf')
});
}
export default function App() {
const [fontLoaded, setFontLoaded] = useState(false);
if (!fontLoaded) {
return <AppLoading startAsync={fetchFont} onFinish={() => setFontLoaded(true)} />;
}
StatusBar.setBarStyle('dark-content', true);
return (
<Provider store={store}>
<View style={styles.container}>
<MealsNavigator />
</View>
</Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1
},
});