diff --git a/packages/uikit-react-native/src/components/ChannelInput/EditInput.tsx b/packages/uikit-react-native/src/components/ChannelInput/EditInput.tsx index 52f0fd52..656ef6bf 100644 --- a/packages/uikit-react-native/src/components/ChannelInput/EditInput.tsx +++ b/packages/uikit-react-native/src/components/ChannelInput/EditInput.tsx @@ -31,6 +31,7 @@ const EditInput = forwardRef(function EditInput( autoFocus, mentionedUsers, inputDisabled, + partialTextInputProps, }, ref, ) { @@ -70,6 +71,7 @@ const EditInput = forwardRef(function EditInput( (function SendInput( messageToReply, setMessageToReply, messageForThread, + partialTextInputProps, }, ref, ) { @@ -116,7 +118,19 @@ const SendInput = forwardRef(function SendInput( ...messageReplyParams, }).catch(onFailureToSend); - onChangeText(''); + // On iOS with autoCorrect enabled, calling onChangeText('') immediately after sending + // can be ignored due to the keyboard's autocorrect not being committed yet. + // Delay the clear call slightly to allow the autocorrected text to be applied first. + if (Platform.OS === 'ios') { + const textInputRef = ref as React.MutableRefObject; + if (textInputRef.current) { + setTimeout(() => { + onChangeText(''); + }, 10); + } + } else { + onChangeText(''); + } setMessageToReply?.(); }; @@ -186,6 +200,7 @@ const SendInput = forwardRef(function SendInput( {AttachmentsButton && openSheet({ sheetItems })} disabled={inputDisabled} />} React.ReactNode | null; MessageToReplyPreview?: (props: MessageToReplyPreviewProps) => React.ReactNode | null; VoiceMessageInput?: (props: VoiceMessageInputProps) => React.ReactNode | null; + + // TextInput props - only safe properties that don't interfere with UIKit functionality + partialTextInputProps?: Partial>; }; const AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false }); diff --git a/packages/uikit-react-native/src/domain/groupChannel/types.ts b/packages/uikit-react-native/src/domain/groupChannel/types.ts index 961398e8..59d0def2 100644 --- a/packages/uikit-react-native/src/domain/groupChannel/types.ts +++ b/packages/uikit-react-native/src/domain/groupChannel/types.ts @@ -53,6 +53,8 @@ export interface GroupChannelProps { searchItem?: GroupChannelProps['MessageList']['searchItem']; + partialTextInputProps?: GroupChannelProps['Input']['partialTextInputProps']; + /** * @description You can specify the query parameters for the message list. * @example @@ -111,7 +113,8 @@ export interface GroupChannelProps { | 'onPressUpdateUserMessage' | 'onPressUpdateFileMessage' | 'SuggestedMentionList' - | 'AttachmentsButton', + | 'AttachmentsButton' + | 'partialTextInputProps', 'inputDisabled' >; diff --git a/packages/uikit-react-native/src/fragments/createGroupChannelFragment.tsx b/packages/uikit-react-native/src/fragments/createGroupChannelFragment.tsx index 5afbe201..88bdce94 100644 --- a/packages/uikit-react-native/src/fragments/createGroupChannelFragment.tsx +++ b/packages/uikit-react-native/src/fragments/createGroupChannelFragment.tsx @@ -70,6 +70,7 @@ const createGroupChannelFragment = (initModule?: Partial): G flatListComponent, flatListProps, messageListQueryParams, + partialTextInputProps, collectionCreator, }) => { const { playerService, recorderService } = usePlatformService(); @@ -341,6 +342,7 @@ const createGroupChannelFragment = (initModule?: Partial): G onPressSendFileMessage={onPressSendFileMessage} onPressUpdateUserMessage={onPressUpdateUserMessage} onPressUpdateFileMessage={onPressUpdateFileMessage} + partialTextInputProps={partialTextInputProps} />