-
-
Notifications
You must be signed in to change notification settings - Fork 118
/
App.js
50 lines (40 loc) · 1.31 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
// Copyright (c) 2018, Amaury Martiny
// SPDX-License-Identifier: GPL-3.0
import React, { PureComponent } from 'react';
import { Constants, Font } from 'expo';
import { Provider } from 'mobx-react';
import Sentry from 'sentry-expo';
import { RootStore } from './stores';
import { Background as LoadingBackground } from './Screens/Loading/Background';
import { Screens } from './Screens';
// Set up global MST stores
const stores = RootStore.create({ api: undefined, error: false, location: {} });
// Remove this once Sentry is correctly setup.
Sentry.enableInExpoDevelopment = true;
if (Constants.manifest.extra.sentryPublicDsn) {
Sentry.config(Constants.manifest.extra.sentryPublicDsn).install();
}
export class App extends PureComponent {
state = {
fontLoaded: false
};
async componentDidMount () {
// Using custom fonts with Expo
// https://docs.expo.io/versions/latest/guides/using-custom-fonts
await Font.loadAsync({
'gotham-black': require('../assets/fonts/Gotham-Black.ttf'),
'gotham-book': require('../assets/fonts/Gotham-Book.ttf')
});
this.setState({ fontLoaded: true });
}
render () {
const { fontLoaded } = this.state;
return fontLoaded ? (
<Provider stores={stores}>
<Screens />
</Provider>
) : (
<LoadingBackground />
);
}
}