-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathmessagelist.android.js
121 lines (110 loc) · 3.31 KB
/
messagelist.android.js
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
'use strict';
import React from 'react';
import ReactNative from 'react-native';
const {requireNativeComponent, ViewPropTypes} = ReactNative;
import PropTypes from 'prop-types';
export default class MessageList extends React.Component {
constructor(props) {
super(props);
this._onLinkClick = this._onLinkClick.bind(this);
this._onMsgClick = this._onMsgClick.bind(this);
this._onClickChangeAutoScroll = this._onClickChangeAutoScroll.bind(this);
this._onAvatarClick = this._onAvatarClick.bind(this);
this._onStatusViewClick = this._onStatusViewClick.bind(this);
this._onTouchMsgList = this._onTouchMsgList.bind(this);
this._onClickScanImageView = this._onClickScanImageView.bind(this);
this._onPullToRefresh = this._onPullToRefresh.bind(this);
}
_onMsgClick(event) {
if (!this.props.onMsgClick) {
return;
}
this.props.onMsgClick(event.nativeEvent.message);
}
_onLinkClick(event) {
if (!this.props.onLinkClick) {
return;
}
this.props.onLinkClick(event.nativeEvent.message);
}
_onClickChangeAutoScroll(event) {
if (!this.props.onClickChangeAutoScroll) {
return;
}
this.props.onClickChangeAutoScroll(event.nativeEvent.isAutoScroll);
}
_onAvatarClick(event) {
if (!this.props.onAvatarClick) {
return;
}
this.props.onAvatarClick(event.nativeEvent.message);
}
_onStatusViewClick(event) {
if (!this.props.onStatusViewClick) {
return;
}
this.props.onStatusViewClick(
event.nativeEvent.message,
event.nativeEvent.opt,
);
}
_onClickScanImageView(event) {
if (!this.props.onClickScanImageView) {
return;
}
this.props.onClickScanImageView(event.nativeEvent);
}
_onTouchMsgList() {
if (!this.props.onTouchMsgList) {
return;
}
this.props.onTouchMsgList();
}
_onPullToRefresh() {
if (!this.props.onPullToRefresh) {
return;
}
this.props.onPullToRefresh();
}
render() {
return (
<RCTMessageList
{...this.props}
onLinkClick={this._onLinkClick}
onMsgClick={this._onMsgClick}
onAvatarClick={this._onAvatarClick}
onClickChangeAutoScroll={this._onClickChangeAutoScroll}
onStatusViewClick={this._onStatusViewClick}
onTouchMsgList={this._onTouchMsgList}
onClickScanImageView={this._onClickScanImageView}
onPullToRefresh={this._onPullToRefresh}
/>
);
}
}
MessageList.propTypes = {
initList: PropTypes.array,
onLinkClick: PropTypes.func,
onMsgClick: PropTypes.func,
onClickChangeAutoScroll: PropTypes.func,
onAvatarClick: PropTypes.func,
onStatusViewClick: PropTypes.func,
onTouchMsgList: PropTypes.func,
onClickScanImageView: PropTypes.func,
onPullToRefresh: PropTypes.func,
sendBubble: PropTypes.object,
receiveBubble: PropTypes.object,
sendBubbleTextColor: PropTypes.string,
receiveBubbleTextColor: PropTypes.string,
sendBubbleTextSize: PropTypes.number,
receiveBubbleTextSize: PropTypes.number,
sendBubblePadding: PropTypes.object,
receiveBubblePadding: PropTypes.object,
dateTextSize: PropTypes.number,
dateTextColor: PropTypes.string,
datePadding: PropTypes.number,
avatarSize: PropTypes.object,
isShowDisplayName: PropTypes.bool,
...ViewPropTypes,
};
const RCTMessageList = requireNativeComponent('RCTMessageList', MessageList);