修复评论不能复制问题

This commit is contained in:
mx1700 2019-08-07 23:26:42 +08:00
parent 4cd7a606a8
commit 4815749589
3 changed files with 19 additions and 4 deletions

View file

@ -23,7 +23,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>30</string>
<string>32</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>

View file

@ -49,7 +49,7 @@ export default class Comment extends Component {
comment.recipient == null
? <Text style={localStyle.content}>{comment.content}</Text>
: (
<Text style={localStyle.content} selectable={true} selectionColor={Color.textSelect}>
<Text style={localStyle.content}>
<Text style={{color: Color.primary}}>@{comment.recipient.name} </Text>
{comment.content}
</Text>

View file

@ -8,7 +8,8 @@ import {
View,
Alert,
Keyboard,
DeviceEventEmitter
DeviceEventEmitter,
Clipboard,
} from 'react-native';
import {Navigation} from 'react-native-navigation';
import {Divider} from "react-native-elements";
@ -131,6 +132,17 @@ export default class CommentList extends Component {
});
}
_onCommentLongPress = (comment) => {
ActionSheet.showActionSheetWithOptions({
options: ['复制内容', '取消'],
cancelButtonIndex: 1,
}, (index) => {
if (index === 0) {
Clipboard.setString(comment.content);
}
});
};
render() {
let selfInfo = this.state.selfInfo;
@ -146,7 +158,10 @@ export default class CommentList extends Component {
renderItem={({item}) => {
return (
<Touchable onPress={() => this._onCommentPress(item)}>
<Touchable
onPress={() => this._onCommentPress(item)}
onLongPress={() => this._onCommentLongPress(item)}
>
<Comment comment={item}
{...this.props}