ReceiveGiftAlert.js
4.62 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
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
const {
AppRegistry,
StyleSheet,
Text,
View,
Image,
ListView,
Dimensions,
TouchableOpacity,
Modal,
} = ReactNative;
export default class ReceiveGiftAlert extends React.Component {
constructor(props) {
super(props);
this._onRequestClose = this._onRequestClose.bind(this);
this.renderRow = this.renderRow.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1.key != r2.key,
});
}
_onRequestClose() {
console.log('_onRequestClose');
}
renderRow(rowData, sectionID, rowID, highlightRow) {
return (
<View style={styles.row}>
<TouchableOpacity style={styles.row} activeOpacity={0.5} onPress={() => {
this.props.onPressCouponItem && this.props.onPressCouponItem(rowData);
}}>
<Image source={require('../images/hyzx_yhq_bg.png')} style={styles.rowIcon} resizeMode={'contain'}/>
<Text style={styles.price}>{rowData.get('couponName')}</Text>
</TouchableOpacity>
</View>
);
}
render() {
let {data} = this.props;
return (
<Modal
visible={this.props.showGiftAlert}
animationType={'none'}
transparent={true}
onRequestClose={this._onRequestClose}
>
<View style={styles.modalStyle}>
<View style={styles.container}>
<Text style={styles.title}>恭喜你领取成功</Text>
<TouchableOpacity style={styles.delete} activeOpacity={0.5} onPress={() => {
this.props.hiddenGiftAlert && this.props.hiddenGiftAlert();
}}>
<Image source={require('../images/close.png')} style={styles.deleteIcon} resizeMode={'contain'}/>
</TouchableOpacity>
<View style={styles.contentContainer}>
<ListView
ref='giftList'
contentContainerStyle={styles.listContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(data)}
renderRow={this.renderRow}
/>
</View>
<View style={styles.detailView}>
<TouchableOpacity activeOpacity={0.5} onPress={() => {
this.props.onPressLookDetail && this.props.onPressLookDetail();
}}>
<Text style={styles.detail}>查看详情</Text>
</TouchableOpacity>
</View>
</View>
</View>
</Modal>
);
}
};
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
modalStyle: {
width: width,
height: height,
backgroundColor: 'rgba(0, 0, 0, 0.6)',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
container: {
height: 360,
width: 280,
alignItems: 'center',
backgroundColor: '#FFFFFF',
borderRadius: 10,
},
title: {
fontSize: 20,
color: '#A69073',
marginTop: 30,
},
delete: {
position: 'absolute',
height: 19,
width: 19,
top: 11,
right: 11,
},
deleteIcon: {
height: 19,
width: 19,
},
contentContainer: {
height: 210,
width: 260,
marginTop: 26,
},
listContainer: {
alignItems: 'center',
},
row: {
height: 110,
width: 200,
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
rowIcon: {
height: 90,
width: 200,
},
price: {
position: 'absolute',
height: 25,
width: 180,
top: 25,
textAlign: 'center',
fontFamily: 'PingFang-SC-Medium',
fontSize: 18,
color: '#FFFFFF',
backgroundColor: 'transparent',
},
detailView: {
marginTop: 30,
borderBottomColor: '#444444',
borderBottomWidth: 2,
},
detail: {
fontFamily: 'PingFang-SC-Medium',
fontSize: 14,
color: '#444444',
},
});