agora-appbuilder-core 4.0.13 → 4.0.14

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.
Files changed (71) hide show
  1. package/package.json +1 -1
  2. package/template/_package-lock.json +1364 -1576
  3. package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
  4. package/template/customization-api/sub-components.ts +6 -4
  5. package/template/customization-api/types.ts +0 -6
  6. package/template/defaultConfig.js +0 -3
  7. package/template/global.d.ts +0 -3
  8. package/template/ios/Podfile.lock +0 -10
  9. package/template/package-lock.json +1364 -1576
  10. package/template/package.json +0 -4
  11. package/template/src/SDKAppWrapper.tsx +8 -2
  12. package/template/src/app-state/useMessages.ts +9 -49
  13. package/template/src/assets/font-styles.css +125 -289
  14. package/template/src/assets/fonts/icomoon.ttf +0 -0
  15. package/template/src/assets/selection.json +1 -1
  16. package/template/src/atoms/ActionMenu.tsx +2 -5
  17. package/template/src/atoms/CustomIcon.tsx +1 -17
  18. package/template/src/atoms/ImageIcon.tsx +3 -19
  19. package/template/src/atoms/Popup.tsx +4 -13
  20. package/template/src/atoms/ToolbarPreset.tsx +57 -6
  21. package/template/src/auth/AuthProvider.tsx +0 -5
  22. package/template/src/auth/config.ts +3 -12
  23. package/template/src/components/Chat.tsx +1 -7
  24. package/template/src/components/ChatContext.ts +0 -12
  25. package/template/src/components/CommonStyles.ts +2 -2
  26. package/template/src/components/Controls.tsx +57 -29
  27. package/template/src/components/Leftbar.tsx +4 -4
  28. package/template/src/components/Navbar.tsx +54 -29
  29. package/template/src/components/NavbarMobile.tsx +23 -33
  30. package/template/src/components/PinnedVideo.tsx +1 -1
  31. package/template/src/components/RTMConfigure.tsx +0 -1
  32. package/template/src/components/SdkApiContext.tsx +4 -1
  33. package/template/src/components/chat-messages/useChatMessages.tsx +607 -411
  34. package/template/src/components/chat-ui/useChatUIControls.tsx +0 -53
  35. package/template/src/components/meeting-info-invite/MeetingInfoGridTile.tsx +1 -4
  36. package/template/src/components/participants/Participant.tsx +1 -0
  37. package/template/src/components/precall/joinWaitingRoomBtn.native.tsx +1 -6
  38. package/template/src/components/precall/joinWaitingRoomBtn.tsx +1 -6
  39. package/template/src/components/room-info/useRoomInfo.tsx +5 -5
  40. package/template/src/language/default-labels/videoCallScreenLabels.ts +6 -86
  41. package/template/src/pages/VideoCall.tsx +4 -3
  42. package/template/src/pages/video-call/ActionSheetContent.tsx +32 -3
  43. package/template/src/pages/video-call/VideoCallScreenWrapper.tsx +12 -22
  44. package/template/src/pages/video-call/VideoComponent.tsx +11 -5
  45. package/template/src/pages/video-call/index.ts +0 -8
  46. package/template/src/subComponents/ChatBubble.tsx +32 -252
  47. package/template/src/subComponents/ChatContainer.tsx +4 -14
  48. package/template/src/subComponents/ChatInput.ios.tsx +184 -0
  49. package/template/src/subComponents/ChatInput.tsx +100 -276
  50. package/template/src/subComponents/RemoteMutePopup.tsx +131 -12
  51. package/template/src/subComponents/caption/CaptionContainer.tsx +2 -6
  52. package/template/src/subComponents/recording/useRecording.tsx +1 -3
  53. package/template/src/utils/SdkMethodEvents.ts +1 -0
  54. package/template/src/utils/common.tsx +17 -0
  55. package/template/src/utils/index.tsx +0 -30
  56. package/template/src/utils/useEndCall.ts +0 -7
  57. package/template/src/utils/useJoinRoom.ts +7 -33
  58. package/template/android/link-assets-manifest.json +0 -13
  59. package/template/ios/link-assets-manifest.json +0 -13
  60. package/template/src/atoms/InlinePopup.tsx +0 -185
  61. package/template/src/components/chat/chatConfigure.native.tsx +0 -488
  62. package/template/src/components/chat/chatConfigure.tsx +0 -473
  63. package/template/src/subComponents/ChatInput.native.tsx +0 -269
  64. package/template/src/subComponents/chat/ChatActionMenu.tsx +0 -224
  65. package/template/src/subComponents/chat/ChatAttachment.native.tsx +0 -234
  66. package/template/src/subComponents/chat/ChatAttachment.tsx +0 -145
  67. package/template/src/subComponents/chat/ChatEmoji.native.tsx +0 -75
  68. package/template/src/subComponents/chat/ChatEmoji.tsx +0 -181
  69. package/template/src/subComponents/chat/ChatSendButton.tsx +0 -141
  70. package/template/src/subComponents/chat/ChatUploadStatus.tsx +0 -65
  71. package/template/src/subComponents/chat/ImagePopup.tsx +0 -400
@@ -1,234 +0,0 @@
1
- import {Platform, StyleSheet, Text, View} from 'react-native';
2
- import React from 'react';
3
- import IconButton from '../../../src/atoms/IconButton';
4
- import DocumentPicker from 'react-native-document-picker';
5
- import {useRoomInfo} from 'customization-api';
6
- import Toast from '../../../react-native-toast-message';
7
- import {
8
- useChatUIControls,
9
- UploadStatus,
10
- MAX_UPLOAD_SIZE,
11
- } from '../../components/chat-ui/useChatUIControls';
12
- import {useChatConfigure} from '../../components/chat/chatConfigure.native';
13
- import {
14
- ChatMessageType,
15
- SDKChatType,
16
- useChatMessages,
17
- } from '../../components/chat-messages/useChatMessages';
18
- import {
19
- ChatError,
20
- ChatMessage,
21
- ChatMessageChatType,
22
- } from 'react-native-agora-chat';
23
-
24
- import {
25
- chatUploadErrorToastHeading,
26
- chatUploadErrorFileSizeToastHeading,
27
- chatUploadErrorFileSizeToastSubHeading,
28
- chatUploadErrorFileTypeToastSubHeading,
29
- } from '../../language/default-labels/videoCallScreenLabels';
30
- import {useString} from '../../utils/useString';
31
-
32
- export interface ChatAttachmentButtonProps {
33
- render?: (onPress: () => void) => JSX.Element;
34
- }
35
-
36
- interface ExtendedChatMessage extends ChatMessage {
37
- body: {
38
- localPath?: string;
39
- remotePath?: string;
40
- type: ChatMessageType;
41
- };
42
- attributes: {
43
- file_ext?: string;
44
- file_name?: string;
45
- };
46
- }
47
-
48
- export const ChatAttachmentButton = (props: ChatAttachmentButtonProps) => {
49
- const {privateChatUser, setUploadStatus} = useChatUIControls();
50
- const {sendChatSDKMessage} = useChatConfigure();
51
- const {data} = useRoomInfo();
52
-
53
- const {addMessageToPrivateStore, addMessageToStore} = useChatMessages();
54
-
55
- const toastHeadingType = useString(chatUploadErrorToastHeading)();
56
- const toastHeadingSize = useString(chatUploadErrorFileSizeToastHeading)();
57
- const errorSubHeadingSize = useString(chatUploadErrorFileSizeToastSubHeading);
58
- const errorSubHeadingType = useString(chatUploadErrorFileTypeToastSubHeading);
59
-
60
- const fileAllowedTypes = {
61
- zip: true,
62
- txt: true,
63
- doc: true,
64
- pdf: true,
65
- };
66
-
67
- const imageAllowedTypes = {
68
- jpg: true,
69
- jpeg: true,
70
- gif: true,
71
- png: true,
72
- bmp: true,
73
- };
74
-
75
- const onPress = async () => {
76
- console.warn('attachment open');
77
- try {
78
- const result = await DocumentPicker.pick({
79
- type: [
80
- DocumentPicker.types.images,
81
- DocumentPicker.types.pdf,
82
- DocumentPicker.types.doc,
83
- DocumentPicker.types.plainText,
84
- DocumentPicker.types.zip,
85
- DocumentPicker.types.docx,
86
- DocumentPicker.types.ppt,
87
- DocumentPicker.types.pptx,
88
- DocumentPicker.types.xls,
89
- DocumentPicker.types.xlsx,
90
- DocumentPicker.types.csv,
91
- ],
92
- presentationStyle: 'fullScreen',
93
- copyTo: 'documentDirectory',
94
- });
95
-
96
- if (result[0].size > MAX_UPLOAD_SIZE * 1024 * 1024) {
97
- Toast.show({
98
- leadingIconName: 'alert',
99
- type: 'error',
100
- text1: toastHeadingSize,
101
- text2: errorSubHeadingSize(MAX_UPLOAD_SIZE.toString()),
102
- visibilityTime: 3000,
103
- primaryBtn: null,
104
- secondaryBtn: null,
105
- });
106
- return;
107
- }
108
-
109
- //todo check for mime type of file above
110
- const uploadedFileType = result[0].type;
111
- const isImageUploaded = uploadedFileType.indexOf('image/') !== -1;
112
- const isFileUploaded = !isImageUploaded;
113
- const groupID = data.chat.group_id;
114
-
115
- console.warn('file info => ', result[0]);
116
- let filePath =
117
- Platform.OS === 'ios'
118
- ? result[0].fileCopyUri?.replace('file://', '')
119
- : result[0].fileCopyUri;
120
- console.warn('file path sending', filePath);
121
- // replace %20 with space otherwise giving file not found
122
- if (filePath?.includes('%20')) {
123
- filePath = filePath?.replace(/%20/g, ' ');
124
- }
125
-
126
- if (isImageUploaded || isFileUploaded) {
127
- const option = {
128
- type: isImageUploaded ? ChatMessageType.IMAGE : ChatMessageType.FILE,
129
- url: filePath,
130
- to: privateChatUser ? privateChatUser.toString() : groupID,
131
- chatType: privateChatUser
132
- ? SDKChatType.SINGLE_CHAT
133
- : SDKChatType.GROUP_CHAT,
134
- from: data.uid.toString(),
135
- fileName: result[0].name,
136
- ext: {
137
- file_length: result[0].size,
138
- file_ext: uploadedFileType.split('/')[1],
139
- file_name: result[0].name,
140
- file_url: filePath,
141
- from_platform: 'native',
142
- },
143
- };
144
- console.warn('chatOPtion', option);
145
- const onProgress = (localMsgId: string, progress: number) => {
146
- // always gives 100 , its in WIP for agoar-chat-native-sdk
147
- console.warn('upload in progress', progress);
148
- setUploadStatus(UploadStatus.IN_PROGRESS);
149
- };
150
- const onError = (localMsgId: string, error: ChatError) => {
151
- console.warn('upload on error', error);
152
- setUploadStatus(UploadStatus.FAILURE);
153
- };
154
- const onSuccess = (message: ExtendedChatMessage) => {
155
- console.warn('upload on success', message);
156
- const messageData = {
157
- msg: '',
158
- createdTimestamp: message.localTime,
159
- msgId: message.msgId,
160
- isDeleted: false,
161
- type: message.body.type,
162
- thumb: message.body?.localPath,
163
- url: message.body?.remotePath,
164
- ext: message.attributes?.file_ext,
165
- fileName: message.attributes?.file_name,
166
- };
167
- console.warn('message data', messageData);
168
-
169
- // this is local user messages
170
- if (message.chatType === ChatMessageChatType.PeerChat) {
171
- addMessageToPrivateStore(Number(message.to), messageData, true);
172
- } else {
173
- addMessageToStore(Number(message.from), messageData);
174
- }
175
-
176
- setUploadStatus(UploadStatus.SUCCESS);
177
- };
178
- sendChatSDKMessage(option, {onProgress, onError, onSuccess});
179
- } else {
180
- Toast.show({
181
- leadingIconName: 'chat_attachment_unknown',
182
- type: 'info',
183
- text1: toastHeadingType,
184
- text2: errorSubHeadingType(uploadedFileType),
185
- visibilityTime: 3000,
186
- primaryBtn: null,
187
- secondaryBtn: null,
188
- });
189
- }
190
-
191
- // const allowedFormats = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', '.zip', '.txt', '.doc', '.pdf'];
192
- // if (!allowedFormats.some(format => result[0].type === format || result[0].name.endsWith(format))) {
193
- // Toast.show({
194
- // leadingIconName: 'alert',
195
- // type: 'error',
196
- // text2: 'Inavlid upload format',
197
- // text1: 'Upload Failed',
198
- // visibilityTime: 3000,
199
- // });
200
- // }
201
- } catch (err) {
202
- if (DocumentPicker.isCancel(err)) {
203
- // User cancelled the picker
204
- } else {
205
- console.error(err);
206
- }
207
- }
208
- };
209
- return props?.render ? (
210
- props.render(onPress)
211
- ) : (
212
- <View>
213
- <IconButton
214
- hoverEffect={true}
215
- hoverEffectStyle={{
216
- backgroundColor: $config.ICON_BG_COLOR,
217
- borderRadius: 24,
218
- }}
219
- iconProps={{
220
- iconType: 'plain',
221
- iconContainerStyle: {
222
- padding: 4,
223
- },
224
- iconSize: 24,
225
- name: 'chat_attachment',
226
- tintColor: $config.SECONDARY_ACTION_COLOR,
227
- }}
228
- onPress={onPress}
229
- />
230
- </View>
231
- );
232
- };
233
-
234
- const styles = StyleSheet.create({});
@@ -1,145 +0,0 @@
1
- import React from 'react';
2
- import {StyleSheet} from 'react-native';
3
- import IconButton from '../../../src/atoms/IconButton';
4
- import AgoraChat from 'agora-chat';
5
- import {useRoomInfo} from 'customization-api';
6
- import {useChatConfigure} from '../../components/chat/chatConfigure';
7
- import Toast from '../../../react-native-toast-message';
8
- import {
9
- File,
10
- MAX_UPLOAD_SIZE,
11
- UploadStatus,
12
- useChatUIControls,
13
- } from '../../components/chat-ui/useChatUIControls';
14
- import {ChatMessageType} from '../../components/chat-messages/useChatMessages';
15
- import {
16
- chatUploadErrorToastHeading,
17
- chatUploadErrorFileSizeToastHeading,
18
- chatUploadErrorFileSizeToastSubHeading,
19
- chatUploadErrorFileTypeToastSubHeading,
20
- } from '../../language/default-labels/videoCallScreenLabels';
21
- import {useString} from '../../utils/useString';
22
-
23
- export interface ChatAttachmentButtonProps {
24
- render?: (onPress: () => void) => JSX.Element;
25
- }
26
-
27
- export const ChatAttachmentButton = (props: ChatAttachmentButtonProps) => {
28
- const fileInputRef = React.useRef<HTMLInputElement | null>(null);
29
- const {data} = useRoomInfo();
30
- const {privateChatUser, setUploadStatus, setUploadedFiles} =
31
- useChatUIControls();
32
- const {uploadAttachment} = useChatConfigure();
33
- const toastHeadingType = useString(chatUploadErrorToastHeading)();
34
- const toastHeadingSize = useString(chatUploadErrorFileSizeToastHeading)();
35
- const errorSubHeadingSize = useString(chatUploadErrorFileSizeToastSubHeading);
36
- const errorSubHeadingType = useString(chatUploadErrorFileTypeToastSubHeading);
37
-
38
- const fileAllowedTypes = {
39
- zip: true,
40
- txt: true,
41
- doc: true,
42
- pdf: true,
43
- docx: true,
44
- ppt: true,
45
- pptx: true,
46
- xls: true,
47
- xlsx: true,
48
- csv: true,
49
- };
50
-
51
- const imageAllowedTypes = {
52
- jpg: true,
53
- jpeg: true,
54
- gif: true,
55
- png: true,
56
- bmp: true,
57
- };
58
-
59
- const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
60
- const selectedFile = e.target.files && e.target.files[0];
61
- const file = AgoraChat.utils.getFileUrl(e.target);
62
- const uploadedFileType = file.filetype.toLowerCase();
63
- const isImageUploaded = uploadedFileType in imageAllowedTypes;
64
- const isFileUploaded = uploadedFileType in fileAllowedTypes;
65
-
66
- if (file.data.size > MAX_UPLOAD_SIZE * 1024 * 1024) {
67
- Toast.show({
68
- leadingIconName: 'alert',
69
- type: 'error',
70
- text1: toastHeadingSize,
71
- text2: errorSubHeadingSize(MAX_UPLOAD_SIZE.toString()),
72
- visibilityTime: 3000,
73
- primaryBtn: null,
74
- secondaryBtn: null,
75
- });
76
- return;
77
- }
78
- if (!(isImageUploaded || isFileUploaded)) {
79
- // Toast.show({
80
- // leadingIconName: 'chat_attachment_unknown',
81
- // type: 'info',
82
- // text1: toastHeadingType,
83
- // text2: errorSubHeadingType(file.filetype),
84
- // visibilityTime: 3000,
85
- // primaryBtn: null,
86
- // secondaryBtn: null,
87
- // });
88
-
89
- return;
90
- }
91
-
92
- if (!selectedFile) return;
93
-
94
- const uploadedFile: File = {
95
- file_name: file.filename,
96
- file_ext: uploadedFileType,
97
- file_url: '',
98
- file_length: 0,
99
- file_type: isImageUploaded ? ChatMessageType.IMAGE : ChatMessageType.FILE,
100
- file_obj: file,
101
- };
102
- // currently supporting only 1 upload
103
- // setUploadedFiles(prev => [...prev, uploadedFile]);
104
- setUploadedFiles(prev => [uploadedFile]);
105
-
106
- uploadAttachment(uploadedFile);
107
- };
108
- const onPress = () => {
109
- fileInputRef.current.value = null;
110
- fileInputRef.current.click();
111
- };
112
- return props?.render ? (
113
- props.render(onPress)
114
- ) : (
115
- <>
116
- <input
117
- type="file"
118
- accept="image/jpeg, image/png, image/gif, image/bmp, .zip, .txt, .doc, .pdf, .docx, .ppt, .pptx, .xls, .xlsx .csv"
119
- onChange={handleFileUpload}
120
- style={{display: 'none'}}
121
- id={`file-input-`}
122
- ref={fileInputRef}
123
- />
124
- <IconButton
125
- hoverEffect={true}
126
- hoverEffectStyle={{
127
- backgroundColor: $config.ICON_BG_COLOR,
128
- borderRadius: 24,
129
- }}
130
- iconProps={{
131
- iconType: 'plain',
132
- iconContainerStyle: {
133
- padding: 4,
134
- },
135
- iconSize: 24,
136
- name: 'chat_attachment',
137
- tintColor: $config.SECONDARY_ACTION_COLOR,
138
- }}
139
- onPress={onPress}
140
- />
141
- </>
142
- );
143
- };
144
-
145
- const styles = StyleSheet.create({});
@@ -1,75 +0,0 @@
1
- import {StyleSheet, Text, View} from 'react-native';
2
- import React from 'react';
3
- import {useChatUIControls} from '../../components/chat-ui/useChatUIControls';
4
- import IconButton from '../../../src/atoms/IconButton';
5
- //import data from 'emoji-mart-native/data/google.json';
6
- import {Picker} from 'emoji-mart-native';
7
-
8
- export interface ChatEmojiButtonProps {
9
- render?: (onPress: () => void) => JSX.Element;
10
- }
11
-
12
- export const ChatEmojiButton = (props: ChatEmojiButtonProps) => {
13
- const {setShowEmojiPicker} = useChatUIControls();
14
-
15
- const onPress = () => {
16
- setShowEmojiPicker(prev => !prev);
17
- };
18
- return props?.render ? (
19
- props.render(onPress)
20
- ) : (
21
- <View>
22
- <IconButton
23
- hoverEffect={true}
24
- hoverEffectStyle={{
25
- backgroundColor: $config.ICON_BG_COLOR,
26
- borderRadius: 24,
27
- }}
28
- iconProps={{
29
- iconType: 'plain',
30
- iconContainerStyle: {
31
- padding: 4,
32
- },
33
- iconSize: 24,
34
- name: 'chat_emoji',
35
- tintColor: $config.SECONDARY_ACTION_COLOR,
36
- }}
37
- onPress={onPress}
38
- />
39
- </View>
40
- );
41
- };
42
-
43
- export const ChatEmojiPicker = () => {
44
- const {setShowEmojiPicker, setMessage} = useChatUIControls();
45
- const handleEmojiClick = emoji => {
46
- setMessage(prev => prev + ' ' + emoji.native);
47
- };
48
- return (
49
- <View style={styles.emojiContainer} testID={'emoji-container'}>
50
- <Picker
51
- //data={data}
52
- // autoFocus={true}
53
- native={true}
54
- emojiSize={28}
55
- perLine={9}
56
- onPressClose={() => setShowEmojiPicker(false)}
57
- showSkinTones={false}
58
- color={$config.PRIMARY_ACTION_BRAND_COLOR}
59
- theme={
60
- $config.INPUT_FIELD_BACKGROUND_COLOR === '#FFFFFF' ? 'light' : 'dark'
61
- }
62
- showCloseButton={true}
63
- onSelect={handleEmojiClick}
64
- />
65
- </View>
66
- );
67
- };
68
-
69
- const styles = StyleSheet.create({
70
- emojiContainer: {
71
- width: '100%',
72
- flexDirection: 'row',
73
- position: 'relative',
74
- },
75
- });
@@ -1,181 +0,0 @@
1
- import React, {useState} from 'react';
2
- import {View, TouchableOpacity, Text, StyleSheet} from 'react-native';
3
- import EmojiPicker, {
4
- EmojiStyle,
5
- SuggestionMode,
6
- Theme,
7
- } from 'emoji-picker-react';
8
- import {useChatUIControls} from '../../components/chat-ui/useChatUIControls';
9
- import IconButton from '../../../src/atoms/IconButton';
10
-
11
- const css = `
12
- .chatEmojiPicker .epr-emoji-category-label {
13
- font-size:16px;
14
- color:${$config.SECONDARY_ACTION_COLOR};
15
- font-family:'Source Sans Pro';
16
- font-weight:600;
17
- }
18
- .chatEmojiPicker.epr-dark-theme{
19
- --epr-emoji-size: 32px;
20
- --epr-emoji-gap:4px;
21
- --epr-emoji-padding:4px;
22
- --epr-header-padding:12px;
23
- --epr-horizontal-padding:12px;
24
- --epr-category-label-height:24px;
25
- --epr-search-input-border-radius:4px;
26
- --epr-search-bar-inner-padding:8px;
27
- --epr-search-input-text-color:${$config.FONT_COLOR}
28
-
29
- }
30
- .chatEmojiPicker.epr-light-theme{
31
- --epr-emoji-size: 32px;
32
- --epr-emoji-gap:4px;
33
- --epr-emoji-padding:4px;
34
- --epr-header-padding:12px;
35
- --epr-horizontal-padding:12px;
36
- --epr-category-label-height:24px;
37
- --epr-search-input-border-radius:4px;
38
- --epr-search-bar-inner-padding:8px;
39
- --epr-search-input-text-color:${$config.FONT_COLOR}
40
- }
41
- .chatEmojiPicker .epr-category-nav {
42
- padding-top:0 !important
43
- }
44
- .chatEmojiPicker .epr-skin-tones {
45
- visibility:hidden
46
- }
47
-
48
- .chatEmojiPicker .epr-search-container input:focus {
49
- border:1px solid ${$config.PRIMARY_ACTION_BRAND_COLOR}
50
- }
51
-
52
- .chatEmojiPicker .epr-icn-search {
53
- left:8px
54
- }
55
-
56
- .chatEmojiPicker .epr-icn-clear-search {
57
- visibility:hidden
58
- }
59
- .chatEmojiPicker .epr-search-container input {
60
- font-family:'Source Sans Pro' !important;
61
- font-size:14px;
62
- font-weight:400
63
- }
64
-
65
- `;
66
-
67
- export const ChatEmojiPicker: React.FC = () => {
68
- const {setMessage, showEmojiPicker, setShowEmojiPicker} = useChatUIControls();
69
-
70
- const handleEmojiClick = (emojiObject: {emoji: string; names: string[]}) => {
71
- setMessage(prev =>
72
- prev ? prev + ' ' + emojiObject.emoji : emojiObject.emoji,
73
- );
74
- // setShowEmojiPicker(false);
75
- };
76
- return (
77
- <View style={styles.emojiContainer} testID={'emoji-container'}>
78
- <style type="text/css">{css}</style>
79
- <EmojiPicker
80
- style={styles.emojiPicker}
81
- onEmojiClick={handleEmojiClick}
82
- theme={
83
- $config.INPUT_FIELD_BACKGROUND_COLOR === '#FFFFFF'
84
- ? Theme.LIGHT
85
- : Theme.DARK
86
- }
87
- suggestedEmojisMode={SuggestionMode.RECENT}
88
- className="chatEmojiPicker"
89
- lazyLoadEmojis={true}
90
- previewConfig={{showPreview: false}}
91
- height={370}
92
- autoFocusSearch={false}
93
- />
94
- <View
95
- style={{
96
- width: 30,
97
- height: 30,
98
- position: 'absolute',
99
- top: 20,
100
- right: 8,
101
- }}>
102
- <IconButton
103
- hoverEffect={false}
104
- hoverEffectStyle={{
105
- backgroundColor: $config.ICON_BG_COLOR,
106
- borderRadius: 20,
107
- }}
108
- iconProps={{
109
- iconType: 'plain',
110
- iconContainerStyle: {
111
- padding: 5,
112
- },
113
- iconSize: 20,
114
- name: 'close',
115
- tintColor: $config.SECONDARY_ACTION_COLOR,
116
- }}
117
- onPress={() => {
118
- setShowEmojiPicker(false);
119
- }}
120
- />
121
- </View>
122
- </View>
123
- );
124
- };
125
-
126
- export interface ChatEmojiButtonProps {
127
- render?: (onPress: () => void) => JSX.Element;
128
- }
129
-
130
- export const ChatEmojiButton = (props: ChatEmojiButtonProps) => {
131
- const {setShowEmojiPicker} = useChatUIControls();
132
- const onPress = () => {
133
- setShowEmojiPicker(prev => !prev);
134
- };
135
- return props?.render ? (
136
- props.render(onPress)
137
- ) : (
138
- <IconButton
139
- hoverEffect={true}
140
- hoverEffectStyle={{
141
- backgroundColor: $config.ICON_BG_COLOR,
142
- borderRadius: 24,
143
- }}
144
- iconProps={{
145
- iconType: 'plain',
146
- base64: false,
147
- hoverBase64: true,
148
- iconContainerStyle: {
149
- padding: 4,
150
- },
151
- iconSize: 24,
152
- name: 'chat_emoji',
153
- hoverIconName: 'chat_emoji_fill',
154
- tintColor: $config.SECONDARY_ACTION_COLOR,
155
- }}
156
- onPress={onPress}
157
- />
158
- );
159
- };
160
-
161
- const styles = StyleSheet.create({
162
- container: {
163
- flexDirection: 'row',
164
- alignItems: 'center',
165
- },
166
- emojiContainer: {
167
- width: '100%',
168
- flexDirection: 'row',
169
- position: 'relative',
170
- },
171
- emojiPicker: {
172
- width: '100%',
173
- borderWidth: 1,
174
- borderColor: $config.CARD_LAYER_4_COLOR,
175
- marginBottom: 16,
176
- borderBottomLeftRadius: 0,
177
- borderBottomRightRadius: 0,
178
- },
179
- });
180
-
181
- export default ChatEmojiButton;