-
Notifications
You must be signed in to change notification settings - Fork 33
/
app.js
61 lines (53 loc) · 1.03 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
58
59
60
61
import React from 'react'
import { TouchableHighlight, View, Text, StyleSheet } from 'react-native'
import { connect } from 'react-redux'
import { fetchData } from './actions'
let styles
const App = (props) => {
const {
container,
text,
button,
buttonText
} = styles
return (
<View style={container}>
<Text style={text}>Redux Examples</Text>
<TouchableHighlight style={button}>
<Text style={buttonText}>Load Data</Text>
</TouchableHighlight>
</View>
)
}
styles = StyleSheet.create({
container: {
marginTop: 100
},
text: {
textAlign: 'center'
},
button: {
height: 60,
margin: 10,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#0b7eff'
},
buttonText: {
color: 'white'
}
})
function mapStateToProps (state) {
return {
appData: state.appData
}
}
function mapDispatchToProps (dispatch) {
return {
fetchData: () => dispatch(fetchData())
}
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(App)