agora-appbuilder-core 4.0.28-beta-2 → 4.0.28-beta-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/defaultConfig.js +2 -2
- package/template/src/components/chat/chatConfigure.native.tsx +9 -6
- package/template/src/components/chat/chatConfigure.tsx +7 -5
- package/template/src/components/chat-messages/useChatMessages.tsx +1 -0
- package/template/src/subComponents/ChatBubble.tsx +60 -37
- package/template/src/subComponents/ChatInput.tsx +119 -120
- package/template/src/subComponents/chat/ChatEmoji.tsx +3 -7
- package/template/src/subComponents/chat/ChatSendButton.tsx +114 -68
- package/template/agora-rn-uikit/package-lock.json +0 -25024
- package/template/package-lock.json +0 -57746
- package/template/react-native-toast-message/package-lock.json +0 -10553
package/package.json
CHANGED
|
@@ -76,8 +76,8 @@ const DefaultConfig = {
|
|
|
76
76
|
CHAT_ORG_NAME: '',
|
|
77
77
|
CHAT_APP_NAME: '',
|
|
78
78
|
CHAT_URL: '',
|
|
79
|
-
CLI_VERSION: '3.0.28-beta-
|
|
80
|
-
CORE_VERSION: '4.0.28-beta-
|
|
79
|
+
CLI_VERSION: '3.0.28-beta-3',
|
|
80
|
+
CORE_VERSION: '4.0.28-beta-3',
|
|
81
81
|
DISABLE_LANDSCAPE_MODE: false,
|
|
82
82
|
};
|
|
83
83
|
|
|
@@ -30,6 +30,7 @@ interface ChatMessageAttributes {
|
|
|
30
30
|
file_url?: string;
|
|
31
31
|
from_platform?: string;
|
|
32
32
|
channel?: string;
|
|
33
|
+
msg?: string;
|
|
33
34
|
}
|
|
34
35
|
interface chatConfigureContextInterface {
|
|
35
36
|
open: boolean;
|
|
@@ -123,7 +124,7 @@ const ChatConfigure = ({children}) => {
|
|
|
123
124
|
const {msgId, from, body, localTime} = message;
|
|
124
125
|
const chatType = body.type;
|
|
125
126
|
const fromUser = from;
|
|
126
|
-
const {file_ext, file_name, file_url, from_platform, channel} =
|
|
127
|
+
const {file_ext, file_name, file_url, from_platform, channel, msg} =
|
|
127
128
|
message.attributes as ChatMessageAttributes;
|
|
128
129
|
|
|
129
130
|
// prevent cross-channel messages
|
|
@@ -169,7 +170,9 @@ const ChatConfigure = ({children}) => {
|
|
|
169
170
|
.thumbnailRemotePath;
|
|
170
171
|
//@ts-ignore
|
|
171
172
|
const url =
|
|
172
|
-
from_platform === 'web'
|
|
173
|
+
from_platform === 'web'
|
|
174
|
+
? file_url
|
|
175
|
+
: (body as {remotePath?: string})?.remotePath;
|
|
173
176
|
console.warn('url ==>', url);
|
|
174
177
|
if (isGroupChat) {
|
|
175
178
|
showMessageNotification(
|
|
@@ -179,7 +182,7 @@ const ChatConfigure = ({children}) => {
|
|
|
179
182
|
ChatMessageType.IMAGE,
|
|
180
183
|
);
|
|
181
184
|
addMessageToStore(Number(fromUser), {
|
|
182
|
-
msg:
|
|
185
|
+
msg: msg,
|
|
183
186
|
createdTimestamp: localTime,
|
|
184
187
|
msgId: msgId,
|
|
185
188
|
isDeleted: false,
|
|
@@ -199,7 +202,7 @@ const ChatConfigure = ({children}) => {
|
|
|
199
202
|
addMessageToPrivateStore(
|
|
200
203
|
Number(fromUser),
|
|
201
204
|
{
|
|
202
|
-
msg:
|
|
205
|
+
msg: msg,
|
|
203
206
|
createdTimestamp: localTime,
|
|
204
207
|
msgId: msgId,
|
|
205
208
|
isDeleted: false,
|
|
@@ -224,7 +227,7 @@ const ChatConfigure = ({children}) => {
|
|
|
224
227
|
ChatMessageType.FILE,
|
|
225
228
|
);
|
|
226
229
|
addMessageToStore(Number(fromUser), {
|
|
227
|
-
msg:
|
|
230
|
+
msg: msg,
|
|
228
231
|
createdTimestamp: localTime,
|
|
229
232
|
msgId: msgId,
|
|
230
233
|
isDeleted: false,
|
|
@@ -244,7 +247,7 @@ const ChatConfigure = ({children}) => {
|
|
|
244
247
|
addMessageToPrivateStore(
|
|
245
248
|
Number(fromUser),
|
|
246
249
|
{
|
|
247
|
-
msg:
|
|
250
|
+
msg: msg,
|
|
248
251
|
createdTimestamp: localTime,
|
|
249
252
|
msgId: msgId,
|
|
250
253
|
isDeleted: false,
|
|
@@ -133,7 +133,7 @@ const ChatConfigure = ({children}) => {
|
|
|
133
133
|
);
|
|
134
134
|
|
|
135
135
|
addMessageToStore(Number(fromUser), {
|
|
136
|
-
msg:
|
|
136
|
+
msg: message?.ext?.msg,
|
|
137
137
|
createdTimestamp: message.time,
|
|
138
138
|
msgId: message.id,
|
|
139
139
|
isDeleted: false,
|
|
@@ -153,7 +153,7 @@ const ChatConfigure = ({children}) => {
|
|
|
153
153
|
addMessageToPrivateStore(
|
|
154
154
|
Number(fromUser),
|
|
155
155
|
{
|
|
156
|
-
msg:
|
|
156
|
+
msg: message?.ext?.msg,
|
|
157
157
|
createdTimestamp: message.time,
|
|
158
158
|
msgId: message.id,
|
|
159
159
|
isDeleted: false,
|
|
@@ -192,7 +192,7 @@ const ChatConfigure = ({children}) => {
|
|
|
192
192
|
message.type,
|
|
193
193
|
);
|
|
194
194
|
addMessageToStore(Number(fromUser), {
|
|
195
|
-
msg:
|
|
195
|
+
msg: message?.ext?.msg,
|
|
196
196
|
createdTimestamp: message.time,
|
|
197
197
|
msgId: message.id,
|
|
198
198
|
isDeleted: false,
|
|
@@ -214,7 +214,7 @@ const ChatConfigure = ({children}) => {
|
|
|
214
214
|
addMessageToPrivateStore(
|
|
215
215
|
Number(fromUser),
|
|
216
216
|
{
|
|
217
|
-
msg:
|
|
217
|
+
msg: message?.ext?.msg,
|
|
218
218
|
createdTimestamp: message.time,
|
|
219
219
|
msgId: message.id,
|
|
220
220
|
isDeleted: false,
|
|
@@ -342,7 +342,9 @@ const ChatConfigure = ({children}) => {
|
|
|
342
342
|
);
|
|
343
343
|
|
|
344
344
|
const messageData = {
|
|
345
|
-
msg:
|
|
345
|
+
msg:
|
|
346
|
+
option?.msg?.replace(/^(\n)+|(\n)+$/g, '') ||
|
|
347
|
+
option?.ext?.msg?.replace(/^(\n)+|(\n)+$/g, ''),
|
|
346
348
|
createdTimestamp: timeNow(),
|
|
347
349
|
msgId: res?.serverMsgId,
|
|
348
350
|
isDeleted: false,
|
|
@@ -45,6 +45,7 @@ type AttachmentBubbleProps = {
|
|
|
45
45
|
fileExt: string;
|
|
46
46
|
isFullWidth?: boolean;
|
|
47
47
|
fileType?: string;
|
|
48
|
+
msg?: string;
|
|
48
49
|
secondaryComponent?: React.ReactNode;
|
|
49
50
|
containerStyle?: StyleProp<ViewStyle>; // Accepting external styles
|
|
50
51
|
};
|
|
@@ -56,41 +57,46 @@ export const AttachmentBubble: React.FC<AttachmentBubbleProps> = ({
|
|
|
56
57
|
fileType = '',
|
|
57
58
|
secondaryComponent,
|
|
58
59
|
containerStyle,
|
|
60
|
+
msg,
|
|
59
61
|
}) => {
|
|
60
62
|
const {uploadStatus} = useChatUIControls();
|
|
61
63
|
|
|
62
64
|
return (
|
|
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
|
-
|
|
65
|
+
<>
|
|
66
|
+
<View
|
|
67
|
+
style={[
|
|
68
|
+
containerStyle,
|
|
69
|
+
style.fileContainer,
|
|
70
|
+
isFullWidth && {width: '100%'},
|
|
71
|
+
uploadStatus === UploadStatus.FAILURE && {
|
|
72
|
+
borderColor:
|
|
73
|
+
$config.SEMANTIC_ERROR + hexadecimalTransparency['40%'],
|
|
74
|
+
},
|
|
75
|
+
]}>
|
|
76
|
+
<View style={[style.fileBlock]}>
|
|
77
|
+
<ImageIcon
|
|
78
|
+
base64={true}
|
|
79
|
+
iconSize={24}
|
|
80
|
+
iconType="plain"
|
|
81
|
+
name={
|
|
82
|
+
fileType === ChatMessageType.IMAGE
|
|
83
|
+
? 'chat_attachment_image'
|
|
84
|
+
: fileExt === 'pdf'
|
|
85
|
+
? 'chat_attachment_pdf'
|
|
86
|
+
: fileExt === 'doc' || fileExt === 'docx'
|
|
87
|
+
? 'chat_attachment_doc'
|
|
88
|
+
: 'chat_attachment_unknown'
|
|
89
|
+
}
|
|
90
|
+
tintColor={$config.SEMANTIC_NEUTRAL}
|
|
91
|
+
/>
|
|
92
|
+
<Text style={style.bubbleText} numberOfLines={1} ellipsizeMode="tail">
|
|
93
|
+
{fileName}
|
|
94
|
+
</Text>
|
|
95
|
+
</View>
|
|
96
|
+
{secondaryComponent}
|
|
91
97
|
</View>
|
|
92
|
-
{
|
|
93
|
-
|
|
98
|
+
{msg && <Text style={[style.bubbleText, style.fileText]}>{msg}</Text>}
|
|
99
|
+
</>
|
|
94
100
|
);
|
|
95
101
|
};
|
|
96
102
|
|
|
@@ -117,7 +123,6 @@ const ChatBubble = (props: ChatBubbleProps) => {
|
|
|
117
123
|
url,
|
|
118
124
|
thumb,
|
|
119
125
|
fileName,
|
|
120
|
-
fileType,
|
|
121
126
|
ext,
|
|
122
127
|
} = props;
|
|
123
128
|
|
|
@@ -276,12 +281,19 @@ const ChatBubble = (props: ChatBubbleProps) => {
|
|
|
276
281
|
/>
|
|
277
282
|
</View>
|
|
278
283
|
) : null}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
<>
|
|
285
|
+
<Image
|
|
286
|
+
source={{uri: thumb}}
|
|
287
|
+
style={style.previewImg}
|
|
288
|
+
onLoad={handleImageLoad}
|
|
289
|
+
/>
|
|
290
|
+
</>
|
|
284
291
|
</TouchableOpacity>
|
|
292
|
+
{message && (
|
|
293
|
+
<Text style={[style.captionText, style.bubbleText]}>
|
|
294
|
+
{message}
|
|
295
|
+
</Text>
|
|
296
|
+
)}
|
|
285
297
|
{lightboxVisible ? (
|
|
286
298
|
<ImagePopup
|
|
287
299
|
modalVisible={lightboxVisible}
|
|
@@ -300,6 +312,7 @@ const ChatBubble = (props: ChatBubbleProps) => {
|
|
|
300
312
|
<AttachmentBubble
|
|
301
313
|
fileName={fileName}
|
|
302
314
|
fileExt={ext}
|
|
315
|
+
msg={message}
|
|
303
316
|
secondaryComponent={
|
|
304
317
|
<View>
|
|
305
318
|
<MoreMenu
|
|
@@ -405,12 +418,22 @@ const style = StyleSheet.create({
|
|
|
405
418
|
justifyContent: 'center',
|
|
406
419
|
alignItems: 'center',
|
|
407
420
|
},
|
|
408
|
-
|
|
421
|
+
bubbleText: {
|
|
409
422
|
color: $config.FONT_COLOR,
|
|
410
423
|
fontSize: 14,
|
|
411
424
|
lineHeight: 20,
|
|
412
425
|
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
413
426
|
},
|
|
427
|
+
fileText: {
|
|
428
|
+
paddingLeft: 8,
|
|
429
|
+
paddingTop: 8,
|
|
430
|
+
maxWidth: 240,
|
|
431
|
+
},
|
|
432
|
+
captionText: {
|
|
433
|
+
maxWidth: 240,
|
|
434
|
+
paddingLeft: 6,
|
|
435
|
+
paddingTop: 8,
|
|
436
|
+
},
|
|
414
437
|
fileContainer: {
|
|
415
438
|
flexDirection: 'row',
|
|
416
439
|
gap: 2,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
ActivityIndicator,
|
|
17
17
|
Text,
|
|
18
18
|
TouchableOpacity,
|
|
19
|
+
ScrollView,
|
|
19
20
|
} from 'react-native';
|
|
20
21
|
import TextInput from '../atoms/TextInput';
|
|
21
22
|
import {useString} from '../utils/useString';
|
|
@@ -37,7 +38,7 @@ import {ChatEmojiPicker, ChatEmojiButton} from './chat/ChatEmoji';
|
|
|
37
38
|
import {useChatConfigure} from '../components/chat/chatConfigure';
|
|
38
39
|
import hexadecimalTransparency from '../utils/hexadecimalTransparency';
|
|
39
40
|
import {ChatAttachmentButton} from './chat/ChatAttachment';
|
|
40
|
-
import ChatSendButton from './chat/ChatSendButton';
|
|
41
|
+
import ChatSendButton, {handleChatSend} from './chat/ChatSendButton';
|
|
41
42
|
import {
|
|
42
43
|
ChatMessageType,
|
|
43
44
|
SDKChatType,
|
|
@@ -76,7 +77,7 @@ export interface ChatTextInputProps {
|
|
|
76
77
|
export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
77
78
|
let chatInputRef = useRef(null);
|
|
78
79
|
const {
|
|
79
|
-
privateChatUser,
|
|
80
|
+
privateChatUser: selectedUserId,
|
|
80
81
|
message,
|
|
81
82
|
setMessage,
|
|
82
83
|
inputActive,
|
|
@@ -87,6 +88,8 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
|
87
88
|
setUploadedFiles,
|
|
88
89
|
inputHeight,
|
|
89
90
|
setInputHeight,
|
|
91
|
+
setShowEmojiPicker,
|
|
92
|
+
showEmojiPicker,
|
|
90
93
|
} = useChatUIControls();
|
|
91
94
|
const {defaultContent} = useContent();
|
|
92
95
|
const {sendChatSDKMessage, uploadAttachment} = useChatConfigure();
|
|
@@ -126,41 +129,29 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
|
126
129
|
|
|
127
130
|
const chatMessageInputPlaceholder =
|
|
128
131
|
chatType === ChatType.Private
|
|
129
|
-
? privateChatInputPlaceHolder(defaultContent[
|
|
132
|
+
? privateChatInputPlaceHolder(defaultContent[selectedUserId]?.name)
|
|
130
133
|
: groupChatInputPlaceHolder(name);
|
|
131
134
|
|
|
132
135
|
const onChangeText = (text: string) => {
|
|
133
136
|
setMessage(text);
|
|
134
137
|
};
|
|
135
|
-
const onSubmitEditing = () => {
|
|
136
|
-
if (message.length === 0) return;
|
|
137
|
-
const groupID = data.chat.group_id;
|
|
138
|
-
|
|
139
|
-
if (message.length >= MAX_TEXT_MESSAGE_SIZE * 1024) {
|
|
140
|
-
Toast.show({
|
|
141
|
-
leadingIconName: 'alert',
|
|
142
|
-
type: 'error',
|
|
143
|
-
text1: toastHeadingSize,
|
|
144
|
-
text2: errorSubHeadingSize(MAX_TEXT_MESSAGE_SIZE.toString()),
|
|
145
|
-
visibilityTime: 3000,
|
|
146
|
-
primaryBtn: null,
|
|
147
|
-
secondaryBtn: null,
|
|
148
|
-
});
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
138
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
139
|
+
const onSubmitEditing = () => {
|
|
140
|
+
handleChatSend({
|
|
141
|
+
sendChatSDKMessage,
|
|
142
|
+
selectedUserId,
|
|
143
|
+
message,
|
|
144
|
+
setMessage,
|
|
145
|
+
inputActive,
|
|
146
|
+
uploadStatus,
|
|
147
|
+
uploadedFiles,
|
|
148
|
+
setUploadedFiles,
|
|
149
|
+
setInputHeight,
|
|
150
|
+
data,
|
|
151
|
+
setShowEmojiPicker,
|
|
152
|
+
toastHeadingSize,
|
|
153
|
+
errorSubHeadingSize,
|
|
154
|
+
});
|
|
164
155
|
};
|
|
165
156
|
|
|
166
157
|
// with multiline textinput enter prints /n
|
|
@@ -182,6 +173,96 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
|
182
173
|
uploadAttachment(uploadedFiles[0]);
|
|
183
174
|
};
|
|
184
175
|
|
|
176
|
+
const renderTextInput = (style = {}) => (
|
|
177
|
+
<TextInput
|
|
178
|
+
setRef={ref => (chatInputRef.current = ref)}
|
|
179
|
+
onFocus={() => setInputActive(true)}
|
|
180
|
+
onBlur={() => setInputActive(false)}
|
|
181
|
+
value={message}
|
|
182
|
+
multiline={true}
|
|
183
|
+
onChangeText={onChangeText}
|
|
184
|
+
textAlignVertical="top"
|
|
185
|
+
scrollEnabled={true}
|
|
186
|
+
style={{
|
|
187
|
+
color: $config.FONT_COLOR,
|
|
188
|
+
textAlign: 'left',
|
|
189
|
+
width: '100%',
|
|
190
|
+
alignSelf: 'center',
|
|
191
|
+
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
192
|
+
fontWeight: '400',
|
|
193
|
+
height: inputHeight,
|
|
194
|
+
padding: 12,
|
|
195
|
+
fontSize: ThemeConfig.FontSize.small,
|
|
196
|
+
lineHeight: LINE_HEIGHT,
|
|
197
|
+
borderWidth: 1,
|
|
198
|
+
borderColor:
|
|
199
|
+
$config.CARD_LAYER_5_COLOR + hexadecimalTransparency['40%'],
|
|
200
|
+
backgroundColor: $config.CARD_LAYER_2_COLOR,
|
|
201
|
+
borderRadius: 8,
|
|
202
|
+
borderTopRightRadius: isUploadStatusShown ? 0 : 8,
|
|
203
|
+
borderTopLeftRadius: isUploadStatusShown ? 0 : 8,
|
|
204
|
+
maxHeight: MAX_HEIGHT,
|
|
205
|
+
...style,
|
|
206
|
+
}}
|
|
207
|
+
blurOnSubmit={false}
|
|
208
|
+
onSubmitEditing={onSubmitEditing}
|
|
209
|
+
placeholder={chatMessageInputPlaceholder}
|
|
210
|
+
placeholderTextColor={$config.FONT_COLOR + hexadecimalTransparency['40%']}
|
|
211
|
+
autoCorrect={false}
|
|
212
|
+
onKeyPress={handleKeyPress}
|
|
213
|
+
onContentSizeChange={handleContentSizeChange}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
const renderAttachmentBubble = (file, index) => (
|
|
218
|
+
<AttachmentBubble
|
|
219
|
+
key={file.file_id}
|
|
220
|
+
fileName={file.file_name}
|
|
221
|
+
fileExt={file.file_ext}
|
|
222
|
+
isFullWidth={true}
|
|
223
|
+
fileType={file.file_type}
|
|
224
|
+
secondaryComponent={
|
|
225
|
+
file.upload_status === UploadStatus.IN_PROGRESS ? (
|
|
226
|
+
<ActivityIndicator />
|
|
227
|
+
) : file.upload_status === UploadStatus.FAILURE ? (
|
|
228
|
+
<TouchableOpacity onPress={handleUploadRetry}>
|
|
229
|
+
<Text style={style.btnRetry}>{'Retry'}</Text>
|
|
230
|
+
</TouchableOpacity>
|
|
231
|
+
) : file.upload_status === UploadStatus.SUCCESS ? (
|
|
232
|
+
<View>
|
|
233
|
+
<IconButton
|
|
234
|
+
hoverEffect={true}
|
|
235
|
+
hoverEffectStyle={{
|
|
236
|
+
backgroundColor:
|
|
237
|
+
$config.CARD_LAYER_5_COLOR + hexadecimalTransparency['20%'],
|
|
238
|
+
borderRadius: 20,
|
|
239
|
+
}}
|
|
240
|
+
iconProps={{
|
|
241
|
+
iconType: 'plain',
|
|
242
|
+
iconSize: 20,
|
|
243
|
+
iconContainerStyle: {
|
|
244
|
+
padding: 2,
|
|
245
|
+
},
|
|
246
|
+
name: 'close',
|
|
247
|
+
tintColor: $config.SECONDARY_ACTION_COLOR,
|
|
248
|
+
}}
|
|
249
|
+
onPress={() => {
|
|
250
|
+
setUploadedFiles(files =>
|
|
251
|
+
files.filter(uploadedFile => {
|
|
252
|
+
return uploadedFile.file_id !== file.file_id;
|
|
253
|
+
}),
|
|
254
|
+
);
|
|
255
|
+
}}
|
|
256
|
+
/>
|
|
257
|
+
</View>
|
|
258
|
+
) : null
|
|
259
|
+
}
|
|
260
|
+
containerStyle={{
|
|
261
|
+
marginBottom: index !== uploadedFiles.length - 1 ? 6 : 0,
|
|
262
|
+
}}
|
|
263
|
+
/>
|
|
264
|
+
);
|
|
265
|
+
|
|
185
266
|
return props?.render ? (
|
|
186
267
|
props.render(
|
|
187
268
|
message,
|
|
@@ -195,6 +276,7 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
|
195
276
|
<View
|
|
196
277
|
style={[
|
|
197
278
|
style.attachmentContainer,
|
|
279
|
+
|
|
198
280
|
isUploadStatusShown
|
|
199
281
|
? {
|
|
200
282
|
borderTopLeftRadius: 0,
|
|
@@ -203,96 +285,13 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
|
203
285
|
}
|
|
204
286
|
: {borderRadius: 8, borderTopWidth: 1},
|
|
205
287
|
]}>
|
|
206
|
-
{
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
fileExt={file.file_ext}
|
|
211
|
-
isFullWidth={true}
|
|
212
|
-
fileType={file.file_type}
|
|
213
|
-
secondaryComponent={
|
|
214
|
-
file.upload_status === UploadStatus.IN_PROGRESS ? (
|
|
215
|
-
<ActivityIndicator />
|
|
216
|
-
) : file.upload_status === UploadStatus.FAILURE ? (
|
|
217
|
-
<TouchableOpacity onPress={handleUploadRetry}>
|
|
218
|
-
<Text style={style.btnRetry}>{'Retry'}</Text>
|
|
219
|
-
</TouchableOpacity>
|
|
220
|
-
) : file.upload_status === UploadStatus.SUCCESS ? (
|
|
221
|
-
<View>
|
|
222
|
-
<IconButton
|
|
223
|
-
hoverEffect={true}
|
|
224
|
-
hoverEffectStyle={{
|
|
225
|
-
backgroundColor:
|
|
226
|
-
$config.CARD_LAYER_5_COLOR +
|
|
227
|
-
hexadecimalTransparency['20%'],
|
|
228
|
-
borderRadius: 20,
|
|
229
|
-
}}
|
|
230
|
-
iconProps={{
|
|
231
|
-
iconType: 'plain',
|
|
232
|
-
iconSize: 20,
|
|
233
|
-
iconContainerStyle: {
|
|
234
|
-
padding: 2,
|
|
235
|
-
},
|
|
236
|
-
name: 'close',
|
|
237
|
-
tintColor: $config.SECONDARY_ACTION_COLOR,
|
|
238
|
-
}}
|
|
239
|
-
onPress={() => {
|
|
240
|
-
setUploadedFiles(files =>
|
|
241
|
-
files.filter(uploadedFile => {
|
|
242
|
-
return uploadedFile.file_id !== file.file_id;
|
|
243
|
-
}),
|
|
244
|
-
);
|
|
245
|
-
}}
|
|
246
|
-
/>
|
|
247
|
-
</View>
|
|
248
|
-
) : null
|
|
249
|
-
}
|
|
250
|
-
containerStyle={{
|
|
251
|
-
marginBottom: index !== uploadedFiles.length - 1 ? 6 : 0,
|
|
252
|
-
}}
|
|
253
|
-
/>
|
|
254
|
-
))}
|
|
288
|
+
<ScrollView style={{maxHeight: showEmojiPicker ? 120 : '100%'}}>
|
|
289
|
+
{uploadedFiles.map(renderAttachmentBubble)}
|
|
290
|
+
{renderTextInput({borderWidth: 0, padddingLeft: 0})}
|
|
291
|
+
</ScrollView>
|
|
255
292
|
</View>
|
|
256
293
|
) : (
|
|
257
|
-
|
|
258
|
-
setRef={ref => (chatInputRef.current = ref)}
|
|
259
|
-
onFocus={() => setInputActive(true)}
|
|
260
|
-
onBlur={() => setInputActive(false)}
|
|
261
|
-
value={message}
|
|
262
|
-
multiline={true}
|
|
263
|
-
onChangeText={onChangeText}
|
|
264
|
-
textAlignVertical="top"
|
|
265
|
-
scrollEnabled={true}
|
|
266
|
-
style={{
|
|
267
|
-
color: $config.FONT_COLOR,
|
|
268
|
-
textAlign: 'left',
|
|
269
|
-
width: '100%',
|
|
270
|
-
alignSelf: 'center',
|
|
271
|
-
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
272
|
-
fontWeight: '400',
|
|
273
|
-
height: inputHeight,
|
|
274
|
-
padding: 12,
|
|
275
|
-
fontSize: ThemeConfig.FontSize.small,
|
|
276
|
-
lineHeight: LINE_HEIGHT,
|
|
277
|
-
borderWidth: 1,
|
|
278
|
-
borderColor:
|
|
279
|
-
$config.CARD_LAYER_5_COLOR + hexadecimalTransparency['40%'],
|
|
280
|
-
backgroundColor: $config.CARD_LAYER_2_COLOR,
|
|
281
|
-
borderRadius: 8,
|
|
282
|
-
borderTopRightRadius: isUploadStatusShown ? 0 : 8,
|
|
283
|
-
borderTopLeftRadius: isUploadStatusShown ? 0 : 8,
|
|
284
|
-
maxHeight: MAX_HEIGHT,
|
|
285
|
-
}}
|
|
286
|
-
blurOnSubmit={false}
|
|
287
|
-
onSubmitEditing={onSubmitEditing}
|
|
288
|
-
placeholder={chatMessageInputPlaceholder}
|
|
289
|
-
placeholderTextColor={
|
|
290
|
-
$config.FONT_COLOR + hexadecimalTransparency['40%']
|
|
291
|
-
}
|
|
292
|
-
autoCorrect={false}
|
|
293
|
-
onKeyPress={handleKeyPress}
|
|
294
|
-
onContentSizeChange={handleContentSizeChange}
|
|
295
|
-
/>
|
|
294
|
+
renderTextInput()
|
|
296
295
|
)}
|
|
297
296
|
</>
|
|
298
297
|
);
|
|
@@ -331,7 +330,7 @@ const style = StyleSheet.create({
|
|
|
331
330
|
attachmentContainer: {
|
|
332
331
|
paddingHorizontal: 12,
|
|
333
332
|
paddingTop: 12,
|
|
334
|
-
|
|
333
|
+
|
|
335
334
|
backgroundColor: $config.CARD_LAYER_2_COLOR,
|
|
336
335
|
borderWidth: 1,
|
|
337
336
|
borderColor: $config.CARD_LAYER_5_COLOR + hexadecimalTransparency['40%'],
|
|
@@ -130,7 +130,6 @@ export interface ChatEmojiButtonProps {
|
|
|
130
130
|
|
|
131
131
|
export const ChatEmojiButton = (props: ChatEmojiButtonProps) => {
|
|
132
132
|
const {setShowEmojiPicker, uploadedFiles} = useChatUIControls();
|
|
133
|
-
const isBtnDisabled = uploadedFiles.length > 0;
|
|
134
133
|
const onPress = () => {
|
|
135
134
|
setShowEmojiPicker(prev => !prev);
|
|
136
135
|
};
|
|
@@ -143,20 +142,17 @@ export const ChatEmojiButton = (props: ChatEmojiButtonProps) => {
|
|
|
143
142
|
backgroundColor: $config.ICON_BG_COLOR,
|
|
144
143
|
borderRadius: 24,
|
|
145
144
|
}}
|
|
146
|
-
disabled={isBtnDisabled}
|
|
147
145
|
iconProps={{
|
|
148
146
|
iconType: 'plain',
|
|
149
147
|
base64: false,
|
|
150
|
-
hoverBase64:
|
|
148
|
+
hoverBase64: true,
|
|
151
149
|
iconContainerStyle: {
|
|
152
150
|
padding: 4,
|
|
153
151
|
},
|
|
154
152
|
iconSize: 24,
|
|
155
153
|
name: 'chat_emoji',
|
|
156
|
-
hoverIconName:
|
|
157
|
-
tintColor:
|
|
158
|
-
? $config.SEMANTIC_NEUTRAL
|
|
159
|
-
: $config.SECONDARY_ACTION_COLOR,
|
|
154
|
+
hoverIconName: 'chat_emoji_fill',
|
|
155
|
+
tintColor: $config.SECONDARY_ACTION_COLOR,
|
|
160
156
|
}}
|
|
161
157
|
onPress={onPress}
|
|
162
158
|
/>
|