-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
home.js
62 lines (58 loc) · 1.3 KB
/
home.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
58
59
60
61
62
import React from "react";
import { View, Text, TouchableOpacity } from "react-native";
import { connect } from "react-redux";
import { Actions } from "react-native-router-flux";
class Home extends React.Component {
render() {
return (
<View style={styles.fill}>
<View style={styles.header}>
<Text style={styles.text}>Current scene: "{this.props.name}"</Text>
<Text style={styles.text}>Welcome to the home scene.</Text>
<Text style={styles.data}>
{this.props.data ? this.props.data : "No data..."}
</Text>
</View>
<TouchableOpacity
style={styles.button}
onPress={() => {
Actions.page();
}}
>
<Text style={styles.text}> Go to "page" --> </Text>
</TouchableOpacity>
</View>
);
}
}
const styles = {
fill: {
flex: 1
},
header: {
flex: 2,
padding: 20
},
text: {
fontSize: 20,
textAlign: "center",
justifyContent: "center"
},
data: {
marginTop: 100,
fontSize: 30,
textAlign: "center"
},
button: {
flex: 1,
backgroundColor: "green",
justifyContent: "center"
}
};
const mapStateToProps = ({ reducer }) => {
return ({ data } = reducer);
};
export default connect(
mapStateToProps,
{}
)(Home);