-
Notifications
You must be signed in to change notification settings - Fork 32
/
chatinput.ios.js
77 lines (75 loc) · 2.68 KB
/
chatinput.ios.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
import React, {Component} from 'react';
import {View, requireNativeComponent,NativeModules,ViewPropTypes} from 'react-native';
import PropTypes from 'prop-types'
export default class ChatInput extends Component {
constructor(props){
super(props);
this._onFeatureView = this._onFeatureView.bind(this);
this._onShowKeyboard = this._onShowKeyboard.bind(this);
this._onChangeBarHeight = this._onChangeBarHeight.bind(this);
this._onSendTextMessage = this._onSendTextMessage.bind(this);
this._onSendRecordMessage = this._onSendRecordMessage.bind(this);
this._onClickMention = this._onClickMention.bind(this);
}
_onFeatureView(event: Event){
if (!this.props.onFeatureView) {
return;
}
this.props.onFeatureView(event.nativeEvent.inputHeight,event.nativeEvent.showType);
}
_onShowKeyboard(event: Event){
if (!this.props.onShowKeyboard) {
return;
}
this.props.onShowKeyboard(event.nativeEvent.inputHeight,event.nativeEvent.showType);
}
_onChangeBarHeight(event: Event){
if (!this.props.onChangeBarHeight) {
return;
}
this.props.onChangeBarHeight(event.nativeEvent.inputHeight,event.nativeEvent.marginTop);
}
_onSendTextMessage(event: Event){
if (!this.props.onSendTextMessage) {
return;
}
this.props.onSendTextMessage(event.nativeEvent.text,event.nativeEvent.IDArr);
}
_onSendRecordMessage(event: Event){
if(!this.props.onSendRecordMessage){
return;
}
this.props.onSendRecordMessage(event.nativeEvent.Path);
}
_onClickMention(){
if(!this.props.onClickMention){
return;
}
this.props.onClickMention();
}
render() {
return (
<RNCustomInputViewApi
{...this.props}
onFeatureView = {this._onFeatureView}
onShowKeyboard = {this._onShowKeyboard}
onChangeBarHeight = {this._onChangeBarHeight}
onSendTextMessage = {this._onSendTextMessage}
onSendRecordMessage = {this._onSendRecordMessage}
onClickMention = {this._onClickMention}
/>
);
}
}
ChatInput.propTypes = {
...ViewPropTypes,
// menuViewH:PropTypes.number,
defaultToolHeight:PropTypes.number,
onFeatureView:PropTypes.func,
onShowKeyboard:PropTypes.func,
onChangeBarHeight:PropTypes.func,
onSendTextMessage:PropTypes.func,
onSendRecordMessage:PropTypes.func,
onClickMention:PropTypes.func,
};
const RNCustomInputViewApi = requireNativeComponent('RNCustomInputView', ChatInput);