-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
33 lines (30 loc) · 847 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
import React, { Component } from "react";
import { Platform, Text, View } from "react-native";
import Landing from "./src/Landing";
import Search from "./src/Search";
// import PokeLoader from "./src/PokeLoader";
// import SearchBody from "./src/SearchBody";
export default class App extends Component {
state = {
currentScreen: "landing"
};
switchScreen = currentScreen => {
this.setState({ currentScreen });
};
renderScreen = () => {
if (this.state.currentScreen === "landing") {
return <Landing switchScreen={this.switchScreen} />;
} else if (this.state.currentScreen === "search") {
return <Search />;
}
};
render() {
return <View style={styles.container}>{this.renderScreen()}</View>;
}
}
const styles = {
container: {
flex: 1,
marginTop: Platform.OS === "iOS" ? 24 : 0
}
};