...
|
...
|
@@ -15,6 +15,7 @@ import { |
|
|
Easing,
|
|
|
Platform,
|
|
|
TextInput,
|
|
|
Alert,
|
|
|
} from 'react-native'
|
|
|
import UserBrief from '../home/UserBrief';
|
|
|
|
...
|
...
|
@@ -60,6 +61,12 @@ export default class SubjectPost extends Component { |
|
|
this.blurAll = this.blurAll.bind(this);
|
|
|
this.renderToolContainer = this.renderToolContainer.bind(this);
|
|
|
this.someOneToReply = '';
|
|
|
this.replyToSomeOneElse = this.replyToSomeOneElse.bind(this);
|
|
|
|
|
|
this.commentId = '';
|
|
|
this.cidTo = '';
|
|
|
this.replyContent='';
|
|
|
this.commitComment = this.commitComment.bind(this);
|
|
|
}
|
|
|
|
|
|
componentDidMount(){
|
...
|
...
|
@@ -163,6 +170,8 @@ export default class SubjectPost extends Component { |
|
|
style={styles.lzContainer}
|
|
|
onPress={
|
|
|
()=>{
|
|
|
this.cidTo = this.props.authorUid;
|
|
|
this.commentId = '';
|
|
|
this.setState({replyState: this.currentReplyState})
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -196,8 +205,13 @@ export default class SubjectPost extends Component { |
|
|
autoCapitalize={'none'}
|
|
|
autoCorrect={false}
|
|
|
autoFocus={true}
|
|
|
onChangeText={
|
|
|
(text)=>{
|
|
|
this.replyContent = text;
|
|
|
}
|
|
|
}
|
|
|
/>
|
|
|
<Text style={styles.submitText}>发送</Text>
|
|
|
<Text style={styles.submitText} onPress={this.commitComment}>发送</Text>
|
|
|
</View>
|
|
|
</View>
|
|
|
);
|
...
|
...
|
@@ -206,19 +220,30 @@ export default class SubjectPost extends Component { |
|
|
case ReplyState.replySomeone: {
|
|
|
return (
|
|
|
<View style={styles.toolContainer}>
|
|
|
<TouchableOpacity style={styles.imgIcon} onPress={this.showImagePannel}>
|
|
|
<Image source={require('../../images/pic1.png')}/>
|
|
|
<Image style={styles.imgIcon} source={iconSouce}/>
|
|
|
<TouchableOpacity style={styles.imgButton} onPress={this.showImagePannel}>
|
|
|
</TouchableOpacity>
|
|
|
|
|
|
<TouchableOpacity style={styles.keyboardIcon} onPress={this.blurAll}>
|
|
|
<Image style={styles.keyboardIcon} source={require('../../images/jianpan1.png')} />
|
|
|
<Image source={require('../../images/jianpan1.png')} />
|
|
|
</TouchableOpacity>
|
|
|
<View style={styles.rightContainer}>
|
|
|
<Text
|
|
|
style={styles.boardText}
|
|
|
onPress={this.showBoardPannel}
|
|
|
>
|
|
|
{this.props.selectedBoard}
|
|
|
</Text>
|
|
|
<View style={[styles.rightContainer]}>
|
|
|
<TextInput
|
|
|
ref='textInput'
|
|
|
style={styles.replyTextInput}
|
|
|
placeholderTextColor='#b0b0b0'
|
|
|
placeholder={'回复'+this.someOneToReply+':'}
|
|
|
multiline={true}
|
|
|
autoCapitalize={'none'}
|
|
|
autoCorrect={false}
|
|
|
autoFocus={true}
|
|
|
onChangeText={
|
|
|
(text)=>{
|
|
|
this.replyContent = text;
|
|
|
}
|
|
|
}
|
|
|
/>
|
|
|
<Text style={styles.submitText} onPress={this.commitComment}>发送</Text>
|
|
|
</View>
|
|
|
</View>
|
|
|
);
|
...
|
...
|
@@ -229,6 +254,22 @@ export default class SubjectPost extends Component { |
|
|
}
|
|
|
}
|
|
|
|
|
|
commitComment() {
|
|
|
if (this.replyContent.length == 0) {
|
|
|
Alert.alert('抱歉','请先输入内容');
|
|
|
return;
|
|
|
}
|
|
|
let params = {
|
|
|
postId: this.props.postId,
|
|
|
commentId: this.commentId,
|
|
|
cidFrom: this.props.cidFrom,
|
|
|
cidTo: this.cidTo,
|
|
|
authorUid: this.props.authorUid,
|
|
|
content: this.replyContent,
|
|
|
}
|
|
|
this.props.commentWithParams(params);
|
|
|
this.blurAll();
|
|
|
}
|
|
|
renderRow(rowData, sectionId) {
|
|
|
switch (sectionId) {
|
|
|
case 'header':
|
...
|
...
|
@@ -279,7 +320,7 @@ export default class SubjectPost extends Component { |
|
|
style={styles.commentContainer}
|
|
|
onPress={
|
|
|
()=> {
|
|
|
this.replySomeone(rowData.nickName);
|
|
|
this.replyToSomeOneElse(rowData.nickName);
|
|
|
}
|
|
|
}
|
|
|
>
|
...
|
...
|
@@ -290,6 +331,8 @@ export default class SubjectPost extends Component { |
|
|
timeago={rowData.timeago}
|
|
|
isOwner={rowData.LZ}
|
|
|
onPressAvatar={() => {
|
|
|
this.cidTo = rowData.cidTo;
|
|
|
this.commentId = rowData.commentId;
|
|
|
this.props.onPressAvatar && this.props.onPressAvatar();
|
|
|
}}
|
|
|
/>
|
...
|
...
|
@@ -304,8 +347,10 @@ export default class SubjectPost extends Component { |
|
|
}
|
|
|
}
|
|
|
|
|
|
replyToSomeOne(someOne) {
|
|
|
|
|
|
replyToSomeOneElse(someOne) {
|
|
|
this.someOneToReply = someOne;
|
|
|
this.currentReplyState = ReplyState.replySomeone;
|
|
|
this.setState({replyState: this.currentReplyState});
|
|
|
}
|
|
|
|
|
|
renderLikeAvatar(avatars) {
|
...
|
...
|
@@ -328,6 +373,7 @@ const styles = StyleSheet.create({ |
|
|
container: {
|
|
|
top: 0,
|
|
|
flex: 1,
|
|
|
backgroundColor: 'white',
|
|
|
},
|
|
|
likePannel: {
|
|
|
backgroundColor: 'white',
|
...
|
...
|
|