forked from EQuimper/MyOwnChallenge-RnMovieTinder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
64 lines (56 loc) · 1.38 KB
/
main.js
File metadata and controls
64 lines (56 loc) · 1.38 KB
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
import Exponent, { Font } from 'exponent';
import React from 'react';
import { Provider } from 'react-redux';
// import { persistStore } from 'redux-persist';
import {
StyleSheet,
Text,
View,
// AsyncStorage
} from 'react-native';
import EStyleSheet from 'react-native-extended-stylesheet';
import store from './src/redux/store';
import Colors from './constants/Colors';
import Routes from './src/Routes';
EStyleSheet.build(Colors);
const fonts = {
'montserrat-regular': require('./assets/fonts/Montserrat-Regular.ttf'),
'montserrat-bold': require('./assets/fonts/Montserrat-Bold.ttf'),
};
class App extends React.Component {
state = {
fontLoaded: false,
rehydrated: false
}
async componentDidMount() {
// await persistStore(store, {
// storage: AsyncStorage,
// debounce: 500
// });
await Font.loadAsync(fonts);
this.setState({ fontLoaded: true, rehydrated: true });
}
render() {
if (!this.state.fontLoaded && !this.state.rehydrated) {
return (
<View style={styles.container}>
<Text>Loading...</Text>
</View>
);
}
return (
<Provider store={store}>
<Routes />
</Provider>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
}
});
Exponent.registerRootComponent(App);