InvitedFriends.js
5.55 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
'use strict';
import React, { Component } from 'react';
import { Dimensions, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import ListView from 'deprecated-react-native-listview'
import { Immutable } from 'immutable';
const DEVICE_WIDTH_RATIO = Dimensions.get('window').width / 375;
const { width } = Dimensions.get('window');
export default class InvitedFriends extends Component {
constructor(props) {
super(props);
this._renderRow = this._renderRow.bind(this);
this._renderFooter = this._renderFooter.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
_renderRow(rowData, sectionID, rowID) {
return (
<View>
<View style={styles.rowView}>
<View style={styles.rowItemStyle}>
<Text style={styles.nameItemStyle} numberOfLines={1}>{rowData.get("name")}</Text>
</View>
<View style={styles.rowItemStyle}>
<Text style={styles.rowTextStyle}>{rowData.get("dateStr")}</Text>
</View>
<View style={styles.rowItemStyle}>
<Text style={styles.rowTextStyle}>{rowData.get("orderNum")}</Text>
</View>
<View style={styles.rowItemStyle}>
<Text style={styles.rowTextStyle}>{rowData.get("orderAmountStr")}</Text>
</View>
</View>
<View style={styles.lineView}/>
</View>
);
}
_renderFooter(){
return (
<View style={[{height: 50}, {backgroundColor: 'white'}, {justifyContent:'center'}]}>
<Text style={{textAlign: 'center', fontFamily: 'PingFang-SC-Regular', fontSize: 12, color: '#B0B0B0',}}>暂无更多数据</Text>
</View>
)
}
render() {
let {
invitedFriendsList,
} = this.props;
let invitersList = invitedFriendsList.list ? invitedFriendsList.list.toArray() : [];
return (
<View style={styles.container}>
<View style={styles.topImageView}>
<Image style={styles.topImageView} source={{uri:'https://cdn.yoho.cn/app/yohogain/invite/banner.jpg'}} resizeMode={'contain'}/>
</View>
<View style={styles.spaceView}/>
<View style={styles.middleView}>
<View style={styles.textItemStyle}>
<Text style={styles.textsStyle}>我邀请的好友</Text>
</View>
<View style={styles.textItemStyle}>
<Text style={styles.textsStyle}>申请时间</Text>
</View>
<View style={styles.textItemStyle}>
<Text style={styles.textsStyle}>7天订单数</Text>
</View>
<View style={styles.textItemStyle}>
<Text style={styles.textsStyle}>7天订单金额</Text>
</View>
</View>
<View style={styles.lineView}/>
<ListView
ref={(c) => {
this.listView = c;
}}
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(invitersList)}
renderRow={this._renderRow}
renderFooter={this._renderFooter}
onEndReached={() => {
if (invitersList.size !== 0) {
this.props.onEndReached && this.props.onEndReached();
}
}}/>
<TouchableOpacity activeOpacity={1} style={styles.touchableStyle} onPress={() => {
this.props.shareForInvite && this.props.shareForInvite();
}}>
<Text style={styles.buttonStyle}>邀请好友加入有货推手</Text>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
contentContainer: {
width: width,
backgroundColor: 'white',
paddingBottom: 55 * DEVICE_WIDTH_RATIO,
},
topImageView: {
width: width,
height: 118 * DEVICE_WIDTH_RATIO,
},
middleView: {
backgroundColor: 'white',
height: 50 * DEVICE_WIDTH_RATIO,
flexDirection: 'row',
alignItems: 'center',
},
textItemStyle: {
width: width / 4,
alignItems: 'center',
paddingVertical: 18,
},
textsStyle: {
fontFamily: 'PingFang-SC-Medium',
fontSize: 12,
color: '#444444',
},
rowView: {
height: 50 * DEVICE_WIDTH_RATIO,
flexDirection: 'row',
alignItems: 'center',
},
rowItemStyle: {
width: width / 4,
alignItems: 'center',
paddingVertical: 15,
},
nameItemStyle: {
width: width/4-25,
fontFamily: 'PingFang-SC-Regular',
fontSize: 11,
color: '#444444',
textAlign: 'center',
},
rowTextStyle: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 11,
color: '#444444',
},
buttonStyle: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 16,
fontWeight: 'bold',
color: '#FFFFFF',
textAlign: 'center',
},
touchableStyle: {
position: 'absolute',
width: width,
height: 55,
bottom: 0,
borderRadius: 2,
backgroundColor: '#D0021B',
justifyContent: 'center'
},
lineView: {
height: 0.5,
backgroundColor: '#e0e0e0'
},
spaceView: {
height: 10 * DEVICE_WIDTH_RATIO,
backgroundColor: '#F0F0F0'
},
});