YohoCoinNumHeader.js
3.04 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
'use strict';
import React from 'react';
import ReactNative from 'react-native';
const {
Image,
View,
Text,
StyleSheet,
Dimensions,
TouchableOpacity,
} = ReactNative;
export default class YohoCoinNumHeader extends React.Component {
constructor(props) {
super (props);
}
componentDidMount() {
}
render() {
let resource = this.props.resource?this.props.resource.toJS():null;
if (!resource) {
return null;
}
let notice = resource.notice;
let yohocoin_num = resource.yohocoin_num;
let yohoCoinCode = resource.yohoCoinCode;
let heigth_t = notice == '' ? headerHeight : headerHeight + noticeViewHeight;
return (
<View style={{width: width,height: heigth_t,backgroundColor: 'white',}}>
<View style={{width: width,height: headerHeight,backgroundColor: 'white',}}>
<View style={styles.numView}>
<Text style={styles.numText}>{yohocoin_num}</Text>
</View>
<View style={styles.numDetailView}>
<Image style={styles.icon} source={require('../../image/yohocoin_icon.png')}/>
<Text style={styles.numDetailText}>个有货币</Text>
</View>
<View style={styles.button}>
<TouchableOpacity
activeOpacity={1}
style={{width: 100, height: ( 38/154 ) * 100}}
onPress={() => {
this.props.onPressYohoCoinDetail && this.props.onPressYohoCoinDetail(yohoCoinCode)
}}
>
<Image style={styles.image} source={require('../../image/check_detail_btn.png')}/>
</TouchableOpacity>
</View>
</View>
{notice != '' ?
<View style={styles.notice}>
<Image style={styles.noticeIcon} source={require('../../image/yohocoin_notice_ic.png')}/>
<Text style={styles.noticeText}>{notice}</Text>
</View>
: null}
</View>
)
}
};
let {width, height} = Dimensions.get('window');
let headerHeight = Math.ceil((250 / 640) * width);
let noticeViewHeight = Math.ceil((70 / 640) * width);
const styles = StyleSheet.create({
numView: {
marginTop: 20,
width: width,
height: 60,
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center',
},
numText: {
width:width,
backgroundColor: 'white',
color: 'rgb(206,11,36)',
fontSize: 60,
textAlign: 'center',
},
numDetailView: {
width: width,
height: 25,
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'row',
},
icon: {
width: 15,
height: 15,
},
numDetailText: {
backgroundColor: 'white',
color: 'gray',
fontSize: 14,
textAlign: 'center',
},
button: {
marginTop: 7,
width: width,
height: 40,
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center',
},
image: {
width: 100,
height: ( 38/154 ) * 100,
},
notice: {
width: width,
height: noticeViewHeight,
backgroundColor: 'rgb(217,217,217)',
flexDirection: 'row',
alignItems: 'center',
},
noticeIcon: {
width: 15,
height: 15,
marginLeft: 15,
},
noticeText: {
backgroundColor: 'transparent',
color: 'rgb(206,11,36)',
fontSize: 11,
marginLeft: 20,
}
});