Skip to content

Commit 50a8471

Browse files
committed
Merge branch 'master' of github.com:reactnativecomponent/react-native-imui
2 parents eb94d02 + 82a74d9 commit 50a8471

File tree

210 files changed

+13442
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+13442
-159
lines changed

chatinput.ios.js

Lines changed: 62 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,76 @@
1-
'use strict';
2-
3-
import React from 'react';
4-
import ReactNative from 'react-native';
5-
6-
var {
7-
PropTypes,
8-
Component,
9-
} = React;
10-
11-
var {
12-
StyleSheet,
13-
View,
14-
requireNativeComponent,
15-
} = ReactNative;
1+
import React, {Component, PropTypes} from 'react';
2+
import {View, requireNativeComponent,NativeModules} from 'react-native';
163

174
export default class ChatInput extends Component {
18-
19-
constructor(props) {
20-
super(props);
21-
this._onSendText = this._onSendText.bind(this);
22-
this._onSendFiles = this._onSendFiles.bind(this);
23-
this._takePicture = this._takePicture.bind(this);
24-
this._startVideoRecord = this._startVideoRecord.bind(this);
25-
this._finishVideoRecord = this._finishVideoRecord.bind(this);
26-
this._onStartRecordVoice = this._onStartRecordVoice.bind(this);
27-
this._onFinishRecordVoice = this._onFinishRecordVoice.bind(this);
28-
this._onCancelRecordVoice = this._onCancelRecordVoice.bind(this);
29-
this._onSwitchToMicrophoneMode = this._onSwitchToMicrophoneMode.bind(this);
30-
this._onSwitchGalleryMode = this._onSwitchGalleryMode.bind(this);
31-
this._onSwitchToCameraMode = this._onSwitchToCameraMode.bind(this);
32-
this._onShowKeyboard = this._onShowKeyboard.bind(this);
33-
}
34-
35-
_onSendText(event: Event) {
36-
if (!this.props.onSendText) {
37-
return;
5+
constructor(props){
6+
super(props);
7+
this._onFeatureView = this._onFeatureView.bind(this);
8+
this._onShowKeyboard = this._onShowKeyboard.bind(this);
9+
this._onChangeBarHeight = this._onChangeBarHeight.bind(this);
10+
this._onSendTextMessage = this._onSendTextMessage.bind(this);
11+
this._onSendRecordMessage = this._onSendRecordMessage.bind(this);
12+
this._onClickMention = this._onClickMention.bind(this);
3813
}
39-
this.props.onSendText(event.nativeEvent.text);
40-
}
41-
42-
_onSendFiles(event: Event) {
43-
if (!this.props.onSendGalleryFiles) {
44-
return;
14+
_onFeatureView(event: Event){
15+
if (!this.props.onFeatureView) {
16+
return;
17+
}
18+
this.props.onFeatureView(event.nativeEvent.inputHeight,event.nativeEvent.showType);
4519
}
46-
this.props.onSendGalleryFiles(event.nativeEvent.mediaFiles);
47-
}
48-
49-
_takePicture(event: Event) {
50-
if (!this.props.onTakePicture) {
51-
return;
20+
_onShowKeyboard(event: Event){
21+
if (!this.props.onShowKeyboard) {
22+
return;
23+
}
24+
this.props.onShowKeyboard(event.nativeEvent.inputHeight,event.nativeEvent.showType);
5225
}
53-
this.props.onTakePicture(event.nativeEvent.mediaPath);
54-
}
55-
56-
_startVideoRecord() {
57-
if (!this.props.onStartRecordVideo) {
58-
return;
59-
}
60-
this.props.onStartRecordVideo();
61-
}
62-
63-
_finishVideoRecord(event: Event) {
64-
if (!this.props.onFinishRecordVideo) {
65-
return;
26+
_onChangeBarHeight(event: Event){
27+
if (!this.props.onChangeBarHeight) {
28+
return;
29+
}
30+
this.props.onChangeBarHeight(event.nativeEvent.inputHeight,event.nativeEvent.marginTop);
6631
}
67-
this.props.onFinishRecordVideo(event.nativeEvent.mediaPath);
68-
}
69-
70-
_onStartRecordVoice() {
71-
if (!this.props.onStartRecordVoice) {
72-
return;
32+
_onSendTextMessage(event: Event){
33+
if (!this.props.onSendTextMessage) {
34+
return;
35+
}
36+
this.props.onSendTextMessage(event.nativeEvent.text,event.nativeEvent.IDArr);
7337
}
74-
this.props.onStartRecordVoice();
75-
}
76-
77-
_onFinishRecordVoice(event: Event) {
78-
if (!this.props.onFinishRecordVoice) {
79-
return;
38+
_onSendRecordMessage(event: Event){
39+
if(!this.props.onSendRecordMessage){
40+
return;
41+
}
42+
this.props.onSendRecordMessage(event.nativeEvent.Path);
8043
}
81-
this.props.onFinishRecordVoice(event.nativeEvent.mediaPath, event.nativeEvent.duration);
82-
}
83-
84-
_onCancelRecordVoice() {
85-
if (!this.props.onCancelRecordVoice) {
86-
return;
44+
_onClickMention(){
45+
if(!this.props.onClickMention){
46+
return;
47+
}
48+
this.props.onClickMention();
8749
}
88-
this.props.onCancelRecordVoice();
89-
}
9050

91-
_onSwitchToMicrophoneMode() {
92-
if (!this.props.onSwitchToMicrophoneMode) {
93-
return;
51+
render() {
52+
return (
53+
<RNCustomInputViewApi
54+
{...this.props}
55+
onFeatureView = {this._onFeatureView}
56+
onShowKeyboard = {this._onShowKeyboard}
57+
onChangeBarHeight = {this._onChangeBarHeight}
58+
onSendTextMessage = {this._onSendTextMessage}
59+
onSendRecordMessage = {this._onSendRecordMessage}
60+
onClickMention = {this._onClickMention}
61+
/>
62+
);
9463
}
95-
this.props.onSwitchToMicrophoneMode();
96-
}
97-
98-
_onSwitchGalleryMode() {
99-
if (!this.props.onSwitchToGalleryMode) {
100-
return;
101-
}
102-
this.props.onSwitchToGalleryMode();
103-
}
104-
105-
_onSwitchToCameraMode() {
106-
if (!this.props.onSwitchToCameraMode) {
107-
return;
108-
}
109-
this.props.onSwitchToCameraMode();
110-
}
111-
112-
_onShowKeyboard(event: Event) {
113-
if (!this.props.onShowKeyboard) {
114-
return;
115-
}
116-
117-
this.props.onShowKeyboard(event.nativeEvent.keyboard_height);
118-
}
119-
120-
121-
render() {
122-
return (
123-
<RCTChatInput
124-
{...this.props}
125-
onSendText={this._onSendText}
126-
onSendGalleryFiles={this._onSendFiles}
127-
onTakePicture={this._takePicture}
128-
onStartRecordVideo={this._startVideoRecord}
129-
onFinishRecordVideo={this._finishVideoRecord}
130-
onStartRecordVoice={this._onStartRecordVoice}
131-
onFinishRecordVoice={this._onFinishRecordVoice}
132-
onCancelRecordVoice={this._onCancelRecordVoice}
133-
onSwitchToMicrophoneMode={this._onSwitchToMicrophoneMode}
134-
onSwitchToGalleryMode={this._onSwitchGalleryMode}
135-
onSwitchToCameraMode={this._onSwitchToCameraMode}
136-
onShowKeyboard={this._onShowKeyboard}
137-
/>
138-
);
139-
}
140-
14164
}
142-
14365
ChatInput.propTypes = {
144-
menuContainerHeight: PropTypes.number,
145-
onSendText: PropTypes.func,
146-
onSendGalleryFiles: PropTypes.func,
147-
onTakePicture: PropTypes.func,
148-
onStartRecordVideo: PropTypes.func,
149-
onFinishRecordVideo: PropTypes.func,
150-
onStartRecordVoice: PropTypes.func,
151-
onFinishRecordVoice: PropTypes.func,
152-
onCancelRecordVoice: PropTypes.func,
153-
onSwitchToMicrophoneMode: PropTypes.func,
154-
onSwitchToGalleryMode: PropTypes.func,
155-
onSwitchToCameraMode: PropTypes.func,
156-
onShowKeyboard: PropTypes.func,
157-
...View.propTypes
66+
...View.propTypes,
67+
menuViewH:PropTypes.number,
68+
DefaultToolHeight:PropTypes.number,
69+
onFeatureView:PropTypes.func,
70+
onShowKeyboard:PropTypes.func,
71+
onChangeBarHeight:PropTypes.func,
72+
onSendTextMessage:PropTypes.func,
73+
onSendRecordMessage:PropTypes.func,
74+
onClickMention:PropTypes.func,
15875
};
159-
160-
var RCTChatInput = requireNativeComponent('RCTInputView', ChatInput);
76+
const RNCustomInputViewApi = requireNativeComponent('RNCustomInputView', ChatInput);

0 commit comments

Comments
 (0)