-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
57 lines (49 loc) · 1.13 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
56
57
import React, { Component } from "react";
import { Platform, StyleSheet, View } from "react-native";
import Home from "./home/Home.js";
import Feed from "./feed/Feed.js";
import Calendar from "./calendar/Calendar.js";
class App extends Component {
constructor(props) {
super(props);
this.state = {
page: "home"
};
this.changePage = this.changePage.bind(this);
}
/**
* Changes the page of the app
* @param {String} name The name of the page to change to
*/
changePage(name) {
this.setState({ page: name });
}
render() {
switch (this.state.page) {
case "feed":
return (
<View style={styles.app}>
<Feed changePage={this.changePage} />
</View>
);
case "calendar":
return (
<View style={styles.app}>
<Calendar changePage={this.changePage} />
</View>
);
default:
return (
<View style={styles.app}>
<Home changePage={this.changePage} />
</View>
);
}
}
}
const styles = StyleSheet.create({
app: {
flex: 1
}
});
export default App;