forked from ShoutYaDotFlac/ShoutYa
-
Notifications
You must be signed in to change notification settings - Fork 4
/
App.js
37 lines (32 loc) · 1.04 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
import React, {Component} from "react";
import {AppRegistry, Text, TextInput, View} from "react-native";
import Login from './Containers/Login';
import Secured from './Containers/Secured';
import AdminScreen from './Containers/Admin/AdminScreen';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoggedIn: false,
isAdmin: false
}
}
render() {
if (this.state.isAdmin) {
return <AdminScreen
onLogoutPress={() => this.setState({isAdmin: false})}
/>
}
else if (this.state.isLoggedIn)
return <Secured
onLogoutPress={() => this.setState({isLoggedIn: false})}
/>;
else
return <Login
onLoginPress={() => this.setState({isLoggedIn: true})}
onAdminPress={() => this.setState({isAdmin: true})}
/>;
} //end of render
} //end of class
export default App;
AppRegistry.registerComponent(App, () => App);