-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp_8.6.js
67 lines (61 loc) · 1.56 KB
/
App_8.6.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
63
64
65
66
67
import React from 'react'
import {
Text,
View,
ScrollView,
StyleSheet
} from 'react-native'
import { connect } from 'react-redux'
class Books extends React.Component {
render() {
const { books } = this.props
return (
<View style={styles.container}>
<Text style={styles.title}>Books</Text>
<ScrollView
keyboardShouldPersistTaps='always'
style={styles.booksContainer}
>
{
books.map((book, index) => (
<View style={styles.book} key={index}>
<Text style={styles.name}>{book.name}</Text>
<Text style={styles.author}>{book.author}</Text>
</View>
))
}
</ScrollView>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1
},
booksContainer: {
borderTopWidth: 1,
borderTopColor: '#ddd',
flex: 1
},
title: {
paddingTop: 30,
paddingBottom: 20,
fontSize: 20,
textAlign: 'center'
},
book: {
padding: 20
},
name: {
fontSize: 18
},
author: {
fontSize: 14,
color: '#999'
}
})
const mapStateToProps = (state) => ({
books: state.bookReducer.books
})
export default connect(mapStateToProps)(Books)