SPToolContainerPannel.js
6.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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
import React, {Component} from 'react';
import {
View,
Text,
StyleSheet,
Image,
Dimensions,
Keyboard,
TouchableOpacity,
TouchableHighlight,
Platform,
TextInput,
Alert,
NativeModules,
} from 'react-native'
import SlicedImage from '../../../common/components/SlicedImage';
export default class SubjectPost extends Component {
constructor(props) {
super(props);
this.renderReplyContentWithPlaceholder = this.renderReplyContentWithPlaceholder.bind(this);
}
renderReplyContentWithPlaceholder(placeholder) {
return(
<View style={styles.toolContainer}>
<SlicedImage style={styles.imgIcon} source={this.props.iconSouce}/>
<TouchableOpacity style={styles.imgButton} onPress={this.props.showImagePannel}>
</TouchableOpacity>
<TouchableOpacity style={styles.keyboardIcon} onPress={this.props.blurAll}>
<SlicedImage source={this.props.keboardIcon} />
</TouchableOpacity>
<View style={[styles.rightContainer]}>
<TextInput
ref='textInput'
style={styles.replyTextInput}
placeholderTextColor='#b0b0b0'
placeholder={placeholder}
multiline={true}
autoCapitalize={'none'}
autoCorrect={false}
selectionColor={'black'}
autoFocus={true}
maxLength={1000}
onChangeText={
(text)=>{
this.props.onReplyTextChange&&this.props.onReplyTextChange(text);
}
}
onKeyPress={(event)=>{
if (this.props.replyContent >= 1000) {
NativeModules.YH_CommunityHelper.showText('超出1000字符最长限制');
}
}}
/>
<Text style={[styles.submitText, {color:this.props.replyTextColor, borderColor: this.props.replyTextColor}]} onPress={this.props.commitComment}>发送</Text>
</View>
<View style={styles.toolTopLine}/>
<View style={styles.toolBottomLine}/>
</View>
);
}
render() {
switch (this.props.replyState) {
case 0: {//none...
let iconSouce;
if (this.props.likeState == 'Y') {
iconSouce=require('../../images/home/like.png');
} else if (this.props.likeState == 'N'){
iconSouce=require('../../images/home/unlike.png');
}
return (
<View style={styles.toolContainer}>
<SlicedImage style={styles.imgIcon} source={iconSouce}/>
<TouchableOpacity
style={styles.imgButton}
onPress={this.props.onPressLikeOrDislike}>
</TouchableOpacity>
<View style={styles.rightContainer}>
<TouchableOpacity
style={styles.lzContainer}
onPress={
()=> {
this.props.onPressLZContainer&&this.props.onPressLZContainer()
}
}
>
<Text style={styles.fakePlaceHolder}>回复楼主:</Text>
<Text style={styles.replyCountText}>{'已有'+this.props.commentCount+'条回复'}</Text>
</TouchableOpacity>
</View>
<View style={styles.toolTopLine}/>
<View style={styles.toolBottomLine}/>
</View>
);
}
break;
case 1: {// 楼主
return (
<View >
{this.renderReplyContentWithPlaceholder('回复楼主:')}
</View>
)
}
break;
case 2: {// others...
return (
<View>
{this.renderReplyContentWithPlaceholder('回复'+this.props.someOneToReply+':')}
</View>
)
}
break;
default:
break;
}
}
}
let {width, height} = Dimensions.get('window');
const styles = StyleSheet.create({
toolContainer: {
flexDirection: 'row',
height: 41,
alignItems:'center',
backgroundColor: 'white',
paddingLeft: 15,
paddingRight: 15,
},
toolTopLine: {
position: 'absolute',
left: 0,
top: 0,
width: width,
height: 0.5,
backgroundColor: '#e0e0e0',
},
toolBottomLine: {
position: 'absolute',
left: 0,
bottom: 0,
width: width,
height: 0.5,
backgroundColor: '#e0e0e0',
},
imgIcon: {
left:0,
width:19,
height:19,
right: 16,
},
imgButton: {
position:'absolute',
width:19,
height:19,
left: 15,
top: 11,
},
keyboardIcon: {
left: 10,
width:20,
height:20,
right: 8,
},
rightContainer: {
left: 18,
flex: 1,
flexDirection: 'row',
height:41,
alignItems:'center',
paddingRight: 15,
},
replyTextInput: {
flex: 1,
paddingLeft: 10,
paddingRight: 10,
paddingTop: 3,
paddingBottom: 9,
color: 'black',
height: 33,
top: 4,
borderRadius:2,
borderWidth: 0.5,
borderColor: '#a0a0a0',
fontSize: 14,
backgroundColor:'white',
},
submitText: {
borderRadius: 2,
borderWidth: 0.5,
borderColor: '#a0a0a0',
fontSize: 14,
alignItems:'center',
textAlign:'center',
height: 33,
width: 50,
left: 10,
paddingTop: 10,
color: "#b0b0b0"
},
lzContainer: {
flex: 1,
height: 33,
borderRadius:2,
borderWidth: 0.5,
borderColor: '#a0a0a0',
alignItems:'center',
flexDirection: 'row',
paddingLeft: 10,
paddingRight: 10,
},
fakePlaceHolder: {
flex: 1,
fontSize:14,
textAlign: 'left',
color: '#b0b0b0',
height: 32,
paddingTop: 9,
},
replyCountText: {
flex: 1,
fontSize:14,
textAlign: 'right',
color: '#b0b0b0',
paddingTop: 9,
height: 32,
},
});