-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
55 lines (48 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, { Component } from 'react';
import { StatusBar, StyleSheet, Text, View } from 'react-native';
import LoginScreen from './components/LoginScreen.js';
import GradeScreen from './components/GradeScreen.js';
export default class App extends Component {
constructor (props) {
super(props);
this.state = {
sessionid: null,
loggedIn: false,
};
}
componentWillMount () {
StatusBar.setHidden(true);
}
render() {
let curScreen;
if (this.state.loggedIn) {
curScreen = (
<GradeScreen logout={this.logout}/>
);
}
else {
curScreen = (
<LoginScreen onLogin={this.onLogin} />
);
}
return (
<View style={styles.container}>
{curScreen}
</View>
);
}
onLogin = () => {
this.setState({loggedIn: true});
}
logout = () => {
this.setState({loggedIn: false});
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#ffffff',
alignItems: 'center',
justifyContent: 'center',
},
});