AddressCell.js
2.93 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
'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 AddressCell extends Component {
constructor(props) {
super(props);
}
render() {
let {name, mobile, address} = this.props.data;
console.log(this.props.data);
console.log(this.props.channel);
let lineSource = require('../../image/boy_xie.png');
console.log('lalalalalal');
console.log(this.props.channel);
if (this.props.channel == 1) {
lineSource = require('../../image/boy_xie.png');
} else if (this.props.channel == 2) {
lineSource = require('../../image/girl_xie.png');
} else if (this.props.channel == 3) {
lineSource = require('../../image/kids_xie.png');
} else if (this.props.channel == 4) {
lineSource = require('../../image/lifestlye_xie.png');
}
return (
<View style={[styles.container]}>
<View style={styles.topPart}>
<View style={styles.leftPart}>
<Image style={{
width: 22,
height: 22
}} source={require('../../image/icon_dizhi.png')}/>
</View>
<View style={styles.rightPart}>
<Text style={styles.name}>{name}</Text>
<Text style={styles.address}>{address}</Text>
<Text style={styles.mobile}>{mobile}</Text>
</View>
</View>
<Image style={styles.bottomLineImage} source={lineSource}/>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
width: width,
flexDirection: 'column',
backgroundColor: 'white',
borderColor: '#f0f0f0',
borderBottomWidth: 10
},
topPart: {
width: width,
flexDirection: 'row',
alignItems: 'center'
},
leftPart: {
width: 45,
justifyContent: 'center',
alignItems: 'center'
},
rightPart: {
width: width - 45,
flexDirection: 'column'
},
bottomLineImage: {
width: width,
height: 5
},
name: {
fontSize: 17,
marginTop: 13,
marginBottom: 0,
color: '#444444'
},
address: {
fontSize: 14,
marginTop: 13,
marginBottom: 13,
color: '#444444',
lineHeight: 20
},
mobile: {
position: 'absolute',
top: 13,
left: 150,
width: width - 45 - 15 - 150,
textAlign: 'right',
fontSize: 14,
color: '#444444'
}
});