-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
114 lines (99 loc) · 3.56 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import React, { Component } from 'react';
import Sentry from 'sentry-expo';
import { Provider } from 'react-redux';
import { AppRegistry, View, StyleSheet, ActivityIndicator } from 'react-native';
import {
MaterialIcons,
EvilIcons,
Ionicons,
Feather,
FontAwesome,
Entypo
} from '@expo/vector-icons';
import {API_ROOT} from './env';
import {setConfiguration} from './src/utils/configuration';
import { Asset } from 'expo-asset';
import * as Font from 'expo-font'
require('react-native-browser-polyfill');
global.self = global;
const fonts = [
MaterialIcons.font,
EvilIcons.font,
Ionicons.font,
Feather.font,
FontAwesome.font,
Entypo.font, {
'ClearSans-Light': require('./assets/fonts/clear-sans/ClearSans-Light.ttf'),
'ClearSans-Medium': require('./assets/fonts/clear-sans/ClearSans-Medium.ttf'),
'ClearSans-Bold': require('./assets/fonts/clear-sans/ClearSans-Bold.ttf'),
'ClearSans-Regular': require('./assets/fonts/clear-sans/ClearSans-Regular.ttf'),
'SFProDisplay-Thin': require('./assets/fonts/sfpro-display/SFProDisplay-Thin.ttf'),
'SFProDisplay-Light': require('./assets/fonts/sfpro-display/SFProDisplay-Light.ttf'),
'SFProDisplay-UltraLight': require('./assets/fonts/sfpro-display/SFProDisplay-UltraLight.ttf'),
'SFProDisplay-Regular': require('./assets/fonts/sfpro-display/SFProDisplay-Regular.ttf'),
'SFProDisplay-Medium': require('./assets/fonts/sfpro-display/SFProDisplay-Medium.ttf'),
'SFProDisplay-Bold': require('./assets/fonts/sfpro-display/SFProDisplay-Bold.ttf'),
'SFProDisplay-SemiBold': require('./assets/fonts/sfpro-display/SFProDisplay-Semibold.ttf'),
'SFProText-Light': require('./assets/fonts/sfpro-text/SFProText-Light.ttf'),
'SFProText-Regular': require('./assets/fonts/sfpro-text/SFProText-Regular.ttf'),
'SFProText-Medium': require('./assets/fonts/sfpro-text/SFProText-Medium.ttf'),
'SFProText-Bold': require('./assets/fonts/sfpro-text/SFProText-Bold.ttf'),
'SFProText-SemiBold': require('./assets/fonts/sfpro-text/SFProText-SemiBold.ttf')
}
];
const images = [
require('./assets/images/etc/default-avatar.png'),
require('./assets/images/icons/edit.png'),
require('./assets/images/location.png'),
require('./assets/images/map-pin.png')
];
export default class Prezzo extends Component {
state = {
didFontsLoad: false
};
async componentDidMount() {
Sentry.enableInExpoDevelopment = true;
Sentry.config('https://[email protected]/1531257').install();
console.log('Loading fonts.');
try {
setConfiguration('API_ROOT', API_ROOT);
await Promise.all([
...fonts.map(font => Font.loadAsync(font)),
...images.map(image => Asset.fromModule(image).downloadAsync())
]);
console.log('loaded fonts', Font, typeof Font, ' ');
this.setState({ didFontsLoad: true });
} catch (error) {
console.log('error loading fonts', error);
}
}
render() {
const { didFontsLoad } = this.state;
if (!didFontsLoad) {
return (
<View style={styles.container}>
<ActivityIndicator style={styles.loading} />
</View>
);
}
const AppViewContainer = require('./src/containers/shared/AppViewContainer').default;
const store = require('./src/redux/store').default;
return (
<Provider store={store}>
<AppViewContainer />
</Provider>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#333',
alignItems: 'center',
justifyContent: 'center',
},
loading: {
flex: 1,
alignSelf: 'center'
}
});