This repository has been archived by the owner on Jan 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
76 lines (65 loc) · 1.68 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
import React from 'react'
import { StyleSheet, View } from 'react-native'
import { Provider } from 'react-redux'
import { AppLoading } from 'expo'
import * as Font from 'expo-font'
import { FontAwesome, Ionicons } from '@expo/vector-icons'
import store from './store'
import AppNavigator from './navigation/AppNavigator'
import { Sentry } from 'react-native-sentry'
import { SENTRY_DSN } from 'babel-dotenv'
import ErrorBoundary from './components/ErrorBoundary'
console.disableYellowBox = true
function cacheFonts(fonts) {
return fonts.map(font => Font.loadAsync(font))
}
class App extends React.Component {
constructor() {
super()
this.state = {
isReady: false,
}
}
async _loadAssetsAsync() {
const awesomeFont = cacheFonts([FontAwesome.font])
const iconFont = Font.loadAsync(Ionicons.font)
await Promise.all([awesomeFont, iconFont])
}
render() {
if (!this.state.isReady) {
return (
<AppLoading
autoHideSplash={false}
startAsync={this._loadAssetsAsync}
onFinish={() => this.setState({ isReady: true })}
onError={console.warn}
/>
)
}
return (
<ErrorBoundary>
<Provider store={store}>
<View style={styles.container}>
<AppNavigator />
</View>
</Provider>
</ErrorBoundary>
)
}
}
if (SENTRY_DSN) {
Sentry.config(SENTRY_DSN).install()
// set the tag context
Sentry.setTagsContext({
environment: __DEV__ ? 'development' : 'production',
react: true,
})
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
})
// export default from './storybook';
export default App;