-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
72 lines (61 loc) · 1.6 KB
/
App.js
File metadata and controls
72 lines (61 loc) · 1.6 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
65
66
67
68
69
70
71
72
import React from "react";
import { StyleSheet, Text, View, YellowBox } from "react-native";
import { Provider } from "react-redux";
import { createStore } from "redux";
import { AppLoading } from "expo";
import * as Font from "expo-font";
import AppContainer from "./src/navigation";
import * as firebase from "./src/firebase";
import Reducers from "./src/redux/reducers";
firebase.init();
YellowBox.ignoreWarnings([
"Ability to schedule an automatically",
"Provided value for",
"Setting a timer",
]);
console.warn = function () {};
class App extends React.Component {
state = {
isReady: false,
};
/**
* Cache all fonts and images before rendering application
*/
async _cacheResourcesAsync() {
const images = [
require("./assets/tempAvatar.png"),
require("./assets/icon.png"),
require("./assets/splash.png"),
];
const fonts = Font.loadAsync({
"Roboto-Regular": require("./assets/fonts/Roboto-Regular.ttf"),
"Roboto-Bold": require("./assets/fonts/Roboto-Bold.ttf"),
});
return Promise.all([...images, fonts]);
}
render() {
if (!this.state.isReady) {
return (
<AppLoading
startAsync={this._cacheResourcesAsync}
onFinish={() => this.setState({ isReady: true })}
onError={console.warn}
/>
);
}
return (
<Provider store={createStore(Reducers)}>
<AppContainer />
</Provider>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});
export default App;