This repository has been archived by the owner on Jul 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
App.js
57 lines (52 loc) · 1.92 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
import React from 'react';
import { Provider } from 'react-redux';
import {
AppNavigator,
middleware,
navReducer,
} from './src/navigators/AppNavigator';
import configureStore from './src/store/configureStore';
import { persistStore } from 'redux-persist';
import { PersistGate } from 'redux-persist/integration/react';
import Loading from './src/components/Loading';
import { Font, Permissions } from 'expo';
const store = configureStore(navReducer, middleware);
class App extends React.Component {
state = {
fontLoaded: false,
cameraRoll: false,
notification: {},
};
async componentDidMount() {
await Font.loadAsync({
'NunitoSans-Regular': require('./assets/fonts/NunitoSans/NunitoSans-Regular.ttf'),
'NunitoSans-Bold': require('./assets/fonts/NunitoSans/NunitoSans-Bold.ttf'),
'NunitoSans-LightItalic': require('./assets/fonts/NunitoSans/NunitoSans-LightItalic.ttf'),
'NunitoSans-SemiBold': require('./assets/fonts/NunitoSans/NunitoSans-SemiBold.ttf'),
'NunitoSans-ExtraBold': require('./assets/fonts/NunitoSans/NunitoSans-ExtraBold.ttf'),
'NunitoSans-Light': require('./assets/fonts/NunitoSans/NunitoSans-Light.ttf'),
Friendship_version_2: require('./assets/fonts/Friendship/Friendship.ttf'),
Futurice: require('./assets/fonts/Friendship/Friendship-Regular.ttf'),
});
this.setState({ fontLoaded: true });
const { status } = await Permissions.getAsync(Permissions.CAMERA_ROLL);
if (status !== 'granted') {
await Permissions.askAsync(Permissions.CAMERA_ROLL);
}
this.setState({ cameraRoll: true });
}
render() {
const { fontLoaded, cameraRoll } = this.state;
if (!fontLoaded || !cameraRoll) {
return <Loading />;
}
return (
<Provider store={store}>
<PersistGate loading={<Loading />} persistor={persistStore(store)}>
<AppNavigator />
</PersistGate>
</Provider>
);
}
}
export default App;