-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
54 lines (47 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
51
52
53
54
import React from 'react';
import { createStackNavigator,createAppContainer } from "react-navigation";
import LoadingScreen from "./components/LoadingScreen/LoadingScreen";
import cacheAssetsAsync from "./helpers/cacheAssetsAsync";
import assets from "./assets/index";
import NavigationService from "./components/Navigation/NavigationService";
import ToDo from "./pages/ToDo/ToDo";
import HeaderParams from "./components/Header/HeaderParams";
import MagentaHeaderStyle from './components/Header/MagentaHeader.style';
export default class App extends React.Component {
constructor() {
super();
this.state = {
assetsLoaded: false
};
this.loadAssetsAsync = async () => {
try {
await cacheAssetsAsync(assets);
} finally {
this.setState({ assetsLoaded: true });
}
};
}
componentDidMount() {
this.loadAssetsAsync();
}
render() {
const { assetsLoaded } = this.state;
if (assetsLoaded) {
const Root = createStackNavigator({
ToDo: {
screen: ToDo,
navigationOptions: () => ({
title: "Todo List",
...HeaderParams(MagentaHeaderStyle)
})
},
});
const Apps = createAppContainer(Root)
return (
<Apps
/>
);
}
return <LoadingScreen />;
}
}