-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
40 lines (34 loc) · 1000 Bytes
/
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from 'react';
import Login from './src/components/views/Login';
import { Root } from 'native-base';
import { createStackNavigator } from 'react-navigation'
import Logout from './src/components/views/Logout'
import AppRoutes from './appRoutes'
const AppNav = createStackNavigator({ ...AppRoutes, Logout },
{ initialRouteName: 'Home', headerMode: 'none' })
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
login: null
}
}
render() {
const { login } = this.state
return (
<Root>
{login ?
<AppNav screenProps={{ login, onLogout: () => this.setState({ login: null }) }} /> :
<Login onLogin={(login) => this.setState({ login })} />
}
</Root>
);
}
}