...
|
...
|
@@ -10,6 +10,7 @@ import ReactNative, { |
|
|
Dimensions,
|
|
|
InteractionManager,
|
|
|
Platform,
|
|
|
Clipboard,
|
|
|
} from 'react-native';
|
|
|
|
|
|
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
|
...
|
...
|
@@ -20,6 +21,7 @@ import MessageListSmallIconCell from './MessageListSmallIconCell'; |
|
|
import MessageListBigIconCell from './MessageListBigIconCell';
|
|
|
import MessageListTextCell from './MessageListTextCell';
|
|
|
import MessageListOrderCell from './MessageListOrderCell';
|
|
|
import YH_ToolTips from '../../../common/components/YH_ToolTips'
|
|
|
|
|
|
export default class MessageList extends Component {
|
|
|
constructor(props) {
|
...
|
...
|
@@ -29,8 +31,19 @@ export default class MessageList extends Component { |
|
|
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
|
|
|
});
|
|
|
this.loadMessageListCell = this.loadMessageListCell.bind(this);
|
|
|
this.onLongPressListItem = this.onLongPressListItem.bind(this);
|
|
|
this._copy = this._copy.bind(this);
|
|
|
this._delete = this._delete.bind(this);
|
|
|
this.showToolTip = this.showToolTip.bind(this);
|
|
|
this.state = {showToolTips: false,index:0}
|
|
|
}
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
}
|
|
|
|
|
|
onLongPressListItem(itemData, index) {
|
|
|
this.setState({showToolTips: true, index: index});
|
|
|
}
|
|
|
|
|
|
loadMessageListCell(rowData, rowID) {
|
...
|
...
|
@@ -46,15 +59,21 @@ export default class MessageList extends Component { |
|
|
case 205:
|
|
|
case 206:
|
|
|
case 207:
|
|
|
case 208:
|
|
|
case 209:
|
|
|
{
|
|
|
return(
|
|
|
<MessageListSmallIconCell
|
|
|
itemData={rowData}
|
|
|
onPressListItem={(itemData) =>{
|
|
|
this.props.onPressListItem && this.props.onPressListItem(itemData, rowID)
|
|
|
<MessageListSmallIconCell
|
|
|
itemData={rowData}
|
|
|
onPressListItem={(itemData) =>{
|
|
|
this.setState({showToolTips: false});
|
|
|
this.props.onPressListItem && this.props.onPressListItem(itemData, rowID)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/>
|
|
|
onLongPressListItem={(itemData) =>{
|
|
|
this.onLongPressListItem(itemData,rowID);
|
|
|
}}
|
|
|
/>
|
|
|
);
|
|
|
}
|
|
|
break;
|
...
|
...
|
@@ -66,9 +85,13 @@ export default class MessageList extends Component { |
|
|
<MessageListBigIconCell
|
|
|
itemData={rowData}
|
|
|
onPressListItem={(itemData) =>{
|
|
|
this.setState({showToolTips: false});
|
|
|
this.props.onPressListItem && this.props.onPressListItem(itemData, rowID)
|
|
|
}
|
|
|
}
|
|
|
onLongPressListItem={(itemData) =>{
|
|
|
this.onLongPressListItem(itemData,rowID);
|
|
|
}}
|
|
|
/>
|
|
|
);
|
|
|
}
|
...
|
...
|
@@ -80,14 +103,19 @@ export default class MessageList extends Component { |
|
|
case 304:
|
|
|
case 305:
|
|
|
case 402:
|
|
|
case 404:
|
|
|
{
|
|
|
return(
|
|
|
<MessageListOrderCell
|
|
|
itemData={rowData}
|
|
|
onPressListItem={(itemData) =>{
|
|
|
this.setState({showToolTips: false});
|
|
|
this.props.onPressListItem && this.props.onPressListItem(itemData, rowID)
|
|
|
}
|
|
|
}
|
|
|
onLongPressListItem={(itemData) =>{
|
|
|
this.onLongPressListItem(itemData,rowID);
|
|
|
}}
|
|
|
/>
|
|
|
);
|
|
|
}
|
...
|
...
|
@@ -99,6 +127,9 @@ export default class MessageList extends Component { |
|
|
return(
|
|
|
<MessageListTextCell
|
|
|
itemData={rowData}
|
|
|
onLongPressListItem={(itemData) =>{
|
|
|
this.onLongPressListItem(itemData);
|
|
|
}}
|
|
|
/>
|
|
|
);
|
|
|
}
|
...
|
...
|
@@ -110,13 +141,47 @@ export default class MessageList extends Component { |
|
|
}
|
|
|
}
|
|
|
|
|
|
_copy(rowData) {
|
|
|
this.setState({showToolTips: false});
|
|
|
let copyString = rowData.get('title','') + ' ' +rowData.get('body',{}).get('content','');
|
|
|
Clipboard.setString(copyString);
|
|
|
}
|
|
|
|
|
|
_delete(rowData) {
|
|
|
this.setState({showToolTips: false});
|
|
|
this.props.deleteListItem && this.props.deleteListItem(rowData);
|
|
|
}
|
|
|
|
|
|
showToolTip(rowID, rowData) {
|
|
|
let {showToolTips, index} = this.state;
|
|
|
let show = (index == rowID) && showToolTips;
|
|
|
if (show) {
|
|
|
return(
|
|
|
<YH_ToolTips
|
|
|
style={styles.tips}
|
|
|
actions={[{text: '复制', onPress:() =>{
|
|
|
this._copy(rowData);
|
|
|
}},
|
|
|
{text: '删除', onPress:() =>{
|
|
|
this._delete(rowData);
|
|
|
}}]}
|
|
|
isShow={showToolTips}
|
|
|
itemData={rowData}
|
|
|
/>
|
|
|
);
|
|
|
}else {
|
|
|
<View />
|
|
|
}
|
|
|
}
|
|
|
|
|
|
renderRow(rowData, sectionID, rowID) {
|
|
|
return (
|
|
|
<View style= {styles.cellContainer}>
|
|
|
<MessageListCellHeader
|
|
|
timestamp= {rowData.get('create_date')}
|
|
|
/>
|
|
|
{this.loadMessageListCell(rowData,rowID)}
|
|
|
{this.loadMessageListCell(rowData,rowID)}
|
|
|
{this.showToolTip(rowID, rowData)}
|
|
|
</View>
|
|
|
);
|
|
|
}
|
...
|
...
|
@@ -180,5 +245,10 @@ let styles = StyleSheet.create({ |
|
|
backgroundColor: 'transparent',
|
|
|
flexDirection: 'column',
|
|
|
justifyContent: 'flex-start',
|
|
|
},
|
|
|
tips: {
|
|
|
position: 'absolute',
|
|
|
top: 10,
|
|
|
left: 0
|
|
|
}
|
|
|
}); |
...
|
...
|
|