ContentCell.js
3.26 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
'use strict';
import React, {Component} from 'react';
import Immutable, {Map} from 'immutable';
import ReactNative, {
View,
Text,
Image,
ListView,
StyleSheet,
Dimensions,
TouchableOpacity,
InteractionManager,
Platform,
} from 'react-native';
export default class Detail extends Component {
constructor(props) {
super(props);
this.state = {
totalHeight: 0
}
}
onLayout (reminder) {
let totalHeight = reminder.nativeEvent.layout.height + reminder.nativeEvent.layout.y + 15;
this.setState({totalHeight});
}
render() {
let data = this.props.data;
if (!data) {
return null;
}
return (
<View style={[styles.container, {height: this.state.totalHeight}]}>
<Text style={styles.title}>{data.get('product_name')} </Text>
<View style={styles.pricePannel}>
<Text style={styles.price}> {data.get('format_sales_price')}</Text>
<Text style={styles.originPrice}>{data.get('format_market_price')}</Text>
</View>
<Text style={styles.phrase}> {data.get('phrase')}</Text>
<View style={styles.tagPannel} onLayout={this.onLayout.bind(this)} >
<Text
onPress={()=>{this.props.onPressTag&&this.props.onPressTag(data.get('brand_info').get('brand_domain'))}}
style={styles.tag}>
{data.get('brand_info').get('brand_domain')}
</Text>
<Text
onPress={()=>{this.props.onPressTag&&this.props.onPressTag(data.get('middle_sort_name'))}}
style={styles.tag}>
{data.get('middle_sort_name')}
</Text>
</View>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
width: width,
flexDirection: 'column',
},
title: {
fontSize: 16,
width: width - 30,
marginLeft: 15,
marginTop: 16,
marginBottom: 0,
color: '#444444',
// backgroundColor: 'red',
},
pricePannel: {
marginLeft: 15,
marginTop: 16,
width: width - 30,
flexDirection: 'row',
// backgroundColor: 'red',
},
price: {
fontSize: 16,
color: '#d0021b',
marginRight: 0,
},
originPrice: {
fontSize: 16,
color: '#b0b0b0',
marginLeft: 20,
textDecorationLine: 'line-through'
},
phrase: {
marginLeft: 15,
marginTop: 6,
width: width - 30,
fontSize: 13,
color: '#b0b0b0',
lineHeight: 20,
// backgroundColor: 'red',
},
tagPannel: {
marginLeft: 15,
marginTop: 15,
width: width - 30,
flexDirection: 'row',
marginBottom: 15,
// backgroundColor: 'red',
},
tag: {
paddingTop: 4,
paddingLeft: 10,
paddingRight: 10,
paddingBottom: 4,
marginLeft: 0,
marginRight: 10,
backgroundColor: '#f0f0f0',
fontSize: 12,
color: '#b0b0b0',
}
});