forked from oceanbit/react-native-responsive-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
41 lines (33 loc) · 1.03 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
// @flow
import React, {Component} from "react";
import {Dimensions} from "react-native";
import {StackNavigator, DrawerNavigator} from "react-navigation";
import {AppLoading} from "expo";
import {Images} from "./example/components";
import Home from "./example/home";
import Drawer from "./example/drawer";
import Login from "./example/login";
export default class App extends Component {
state = { ready: false };
componentWillMount() {
Promise
.all(Images.downloadAsync())
.then(() => this.setState({ ready: true }))
.catch(error => console.log(error))
;
}
render(): React$Element<*> {
return this.state.ready ? <AppNavigator /> : <AppLoading />;
}
}
const MainNavigator = DrawerNavigator({
Home: { screen: Home }
}, {
drawerWidth: Dimensions.get("window").width,
contentComponent: Drawer
});
const AppNavigator = StackNavigator({
Login: { screen: Login },
Main: { screen: MainNavigator }
}, { headerMode: "none" });
export {AppNavigator};