SPShareGoodsCell.js
1.78 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
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import ImmutablePropTypes from 'react-immutable-proptypes';
import SlicedImage from '../../../common/components/SlicedImage';
const {
View,
Text,
Image,
TouchableOpacity,
StyleSheet,
Dimensions,
} = ReactNative;
export default class SPShareGoodsCell extends React.Component {
constructor(props) {
super (props);
}
render() {
let {goodsImage, productName, salesPrice} = this.props.data;
return (
<TouchableOpacity onPress={() => {
this.props.onPressShareGoods && this.props.onPressShareGoods();
}}>
<View style={styles.container}>
<SlicedImage style={styles.shareGoodsImage} source={{uri: goodsImage}}/>
<View style={styles.shareGoodsRightPannel}>
<Text style={styles.productNameText}>{productName}</Text>
<Text style={styles.productPriceText}>{'¥' + salesPrice}</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
let {width, height} = Dimensions.get('window');
let lineWidth = width - 30;
let styles = StyleSheet.create({
container: {
flexDirection: 'row',
paddingLeft: 15,
paddingBottom: 10,
backgroundColor: 'white',
},
shareGoodsImage: {
width: 52,
height: 70,
backgroundColor:'gray',
},
shareGoodsRightPannel: {
flexDirection: 'column',
paddingLeft: 10,
paddingTop: 5,
},
productNameText: {
fontSize: 15,
width: width - 52 - 30,
},
productPriceText: {
top: 10,
fontSize: 12,
color: '#d0021b',
},
});