-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
40 lines (37 loc) · 809 Bytes
/
App.js
File metadata and controls
40 lines (37 loc) · 809 Bytes
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
import React from 'react';
import { Platform, Text, View } from 'react-native';
import Landing from './src/Landing';
import Search from './src/Search';
export default class App extends React.Component {
state = {
currentScreen: "landing"
}
switchScreen = (screen) => {
this.setState({currentScreen: screen})
}
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 === 'android' ? 24 : 0
}
}