agora-appbuilder-core 4.1.8-1 → 4.1.8-2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.1.8-1",
3
+ "version": "4.1.8-2",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -77,8 +77,8 @@ const DefaultConfig = {
77
77
  CHAT_ORG_NAME: '',
78
78
  CHAT_APP_NAME: '',
79
79
  CHAT_URL: '',
80
- CLI_VERSION: '3.1.8-1',
81
- CORE_VERSION: '4.1.8-1',
80
+ CLI_VERSION: '3.1.8-2',
81
+ CORE_VERSION: '4.1.8-2',
82
82
  DISABLE_LANDSCAPE_MODE: false,
83
83
  STT_AUTO_START: false,
84
84
  CLOUD_RECORDING_AUTO_START: false,
@@ -17,6 +17,9 @@ import hexadecimalTransparency from '../utils/hexadecimalTransparency';
17
17
 
18
18
  interface TextInputCustomProps extends TextInputProps {
19
19
  setRef?: (ref: any) => void;
20
+ onCompositionStart?: () => void;
21
+ onCompositionEnd?: () => void;
22
+ onInput?: (event: any) => void;
20
23
  }
21
24
 
22
25
  const TextInputCustom = (props: TextInputCustomProps) => {
@@ -97,6 +97,10 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
97
97
  replyToMsgId,
98
98
  setReplyToMsgId,
99
99
  } = useChatUIControls();
100
+
101
+ // Track IME composition state
102
+ const [isComposing, setIsComposing] = React.useState(false);
103
+
100
104
  const {defaultContent} = useContent();
101
105
  const {sendChatSDKMessage, uploadAttachment} = useChatConfigure();
102
106
  const {addMessageToPrivateStore, addMessageToStore} = useChatMessages();
@@ -115,6 +119,41 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
115
119
  });
116
120
  }, []);
117
121
 
122
+ // Set up direct DOM event listeners for IME composition
123
+ useEffect(() => {
124
+ if (!isWeb()) return;
125
+
126
+ const inputElement = chatInputRef?.current;
127
+ if (!inputElement) return;
128
+
129
+ // Get the actual DOM element (React Native Web creates a textarea/input)
130
+ const domElement = inputElement._nativeTag
131
+ ? document.querySelector(`[data-tag="${inputElement._nativeTag}"]`)
132
+ : inputElement;
133
+
134
+ if (!domElement) return;
135
+
136
+ const handleCompositionStart = () => {
137
+ setIsComposing(true);
138
+ };
139
+
140
+ const handleCompositionEnd = () => {
141
+ setIsComposing(false);
142
+ };
143
+
144
+ // Add event listeners directly to DOM element
145
+ domElement.addEventListener('compositionstart', handleCompositionStart);
146
+ domElement.addEventListener('compositionend', handleCompositionEnd);
147
+
148
+ return () => {
149
+ domElement.removeEventListener(
150
+ 'compositionstart',
151
+ handleCompositionStart,
152
+ );
153
+ domElement.removeEventListener('compositionend', handleCompositionEnd);
154
+ };
155
+ }, [chatInputRef?.current]);
156
+
118
157
  const {data} = useRoomInfo();
119
158
  const [name] = useUserName();
120
159
  const toastHeadingSize = useString(chatSendErrorTextSizeToastHeading)();
@@ -166,9 +205,37 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
166
205
  });
167
206
  };
168
207
 
208
+ // IME composition handlers
209
+ const handleCompositionStart = () => {
210
+ setIsComposing(true);
211
+ };
212
+
213
+ const handleCompositionEnd = () => {
214
+ setIsComposing(false);
215
+ };
216
+
217
+ const handleInput = event => {
218
+ // Reset composition state if input event occurs without active composition
219
+ if (isWeb() && !event.nativeEvent.isComposing && isComposing) {
220
+ setIsComposing(false);
221
+ }
222
+ };
223
+
169
224
  // with multiline textinput enter prints /n
170
225
  const handleKeyPress = ({nativeEvent}) => {
171
- if (nativeEvent.key === 'Enter' && !nativeEvent.shiftKey) {
226
+ const currentlyComposing = nativeEvent.isComposing || isComposing;
227
+
228
+ // Check if this is an Enter key during composition
229
+ if (nativeEvent.key === 'Enter' && currentlyComposing) {
230
+ return;
231
+ }
232
+
233
+ // Only submit on Enter if not composing with IME and no Shift key
234
+ if (
235
+ nativeEvent.key === 'Enter' &&
236
+ !nativeEvent.shiftKey &&
237
+ !currentlyComposing
238
+ ) {
172
239
  nativeEvent.preventDefault();
173
240
  onSubmitEditing();
174
241
  setShowEmojiPicker(false); // This will close emoji picker on enter
@@ -225,6 +292,10 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
225
292
  autoCorrect={false}
226
293
  onKeyPress={handleKeyPress}
227
294
  onChange={_handleHeightChange}
295
+ // IME composition event handlers for React Native Web
296
+ onCompositionStart={isWeb() ? handleCompositionStart : undefined}
297
+ onCompositionEnd={isWeb() ? handleCompositionEnd : undefined}
298
+ onInput={isWeb() ? handleInput : undefined}
228
299
  />
229
300
  );
230
301