-
Notifications
You must be signed in to change notification settings - Fork 0
/
InvoiceList.js
91 lines (80 loc) · 1.73 KB
/
InvoiceList.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
'use strict';
var React = require('react-native');
var _invoiceList = require('./mocks/invoice.json');
var Invoice = require('./Invoice')
var {
Image,
StyleSheet,
Text,
View,
Component,
ListView,
TouchableHighlight,
ActivityIndicatorIOS
} = React;
var styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
},
thumbnail: {
width: 20,
height: 81,
marginRight: 10,
},
rightContainer: {
flex: 1,
justifyContent: 'center',
},
title: {
fontSize: 20,
marginBottom: 8
},
author: {
color: '#656565'
},
separator: {
height: 1,
backgroundColor: '#dddddd'
},
listView: {
},
loading: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
}
});
class InvoiceList extends Component {
constructor(props) {
super(props);
this.state = {
dataSource: new ListView.DataSource({
rowHasChanged: (row1, row2) => row1 !== row2
})
};
}
renderInvoice(invoice) {
return (
<Invoice {...invoice}></Invoice>
)
}
componentDidMount() {
this.setState({
dataSource: this.state.dataSource.cloneWithRows(_invoiceList)
});
}
render() {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderInvoice.bind(this)}
style={styles.listView}
/>
);
}
}
module.exports = InvoiceList;