diff --git a/CHANGELOG.md b/CHANGELOG.md index 34c60c47..b9781f0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). # Upcoming -### 🔄 Changed +### 🐞 Fixed +- Reset composer text when there is provisional text (e.g. Japanese - kana keyboard) but the text is reset to empty string [#512](https://github.com/GetStream/stream-chat-swiftui/pull/512) # [4.57.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.57.0) _June 07, 2024_ diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerTextInputView.swift b/Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerTextInputView.swift index 21d1af33..fd847222 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerTextInputView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerTextInputView.swift @@ -43,7 +43,9 @@ struct ComposerTextInputView: UIViewRepresentable { func updateUIView(_ uiView: InputTextView, context: Context) { DispatchQueue.main.async { - if uiView.markedTextRange == nil { + // Clear marked text if text is reset + let canUpdate = uiView.markedTextRange == nil || text.isEmpty + if canUpdate { var shouldAnimate = false if uiView.text != text { let previousLocation = selectedRangeLocation diff --git a/StreamChatSwiftUI.xcodeproj/project.pbxproj b/StreamChatSwiftUI.xcodeproj/project.pbxproj index 5bee1810..ae5ae5bd 100644 --- a/StreamChatSwiftUI.xcodeproj/project.pbxproj +++ b/StreamChatSwiftUI.xcodeproj/project.pbxproj @@ -1704,29 +1704,29 @@ 8465FD0F2746A95600AF091E /* Composer */ = { isa = PBXGroup; children = ( - 84EADEB32B2893420046B50C /* VoiceRecording */, 84AB7B222773526D00631A10 /* Suggestions */, - 8465FD1B2746A95600AF091E /* MessageComposerView.swift */, - 8465FD102746A95600AF091E /* MessageComposerViewModel.swift */, - 84EADEC02B2AFA690046B50C /* MessageComposerViewModel+Recording.swift */, - 84EADEB12B2883C60046B50C /* TrailingComposerView.swift */, + 84EADEB32B2893420046B50C /* VoiceRecording */, + 8465FD1E2746A95600AF091E /* AddedFileAttachmentsView.swift */, + 8465FD172746A95600AF091E /* AddedImageAttachmentsView.swift */, 8465FD112746A95600AF091E /* AttachmentPickerTypeView.swift */, 8465FD1C2746A95600AF091E /* AttachmentPickerView.swift */, + 8465FD192746A95600AF091E /* AttachmentUploadingStateView.swift */, + 844CC60D2811378D0006548D /* ComposerConfig.swift */, + 8465FD1A2746A95600AF091E /* ComposerHelperViews.swift */, + 841B64C327744DB60016FF3B /* ComposerModels.swift */, 8465FD132746A95600AF091E /* ComposerTextInputView.swift */, - 8492975127B156D000A8EEB0 /* SlowModeView.swift */, - 8465FD1D2746A95600AF091E /* PhotoAttachmentPickerView.swift */, - 8465FD172746A95600AF091E /* AddedImageAttachmentsView.swift */, - 8465FD1E2746A95600AF091E /* AddedFileAttachmentsView.swift */, - 8465FD122746A95600AF091E /* SendMessageButton.swift */, 8465FD142746A95600AF091E /* DiscardAttachmentButton.swift */, 8465FD152746A95600AF091E /* FilePickerView.swift */, 8465FD162746A95600AF091E /* ImagePickerView.swift */, - 84DEC8EB27611CAE00172876 /* SendInChannelView.swift */, - 8465FD192746A95600AF091E /* AttachmentUploadingStateView.swift */, - 8465FD1A2746A95600AF091E /* ComposerHelperViews.swift */, - 841B64C327744DB60016FF3B /* ComposerModels.swift */, + 8465FD1B2746A95600AF091E /* MessageComposerView.swift */, + 8465FD102746A95600AF091E /* MessageComposerViewModel.swift */, + 84EADEC02B2AFA690046B50C /* MessageComposerViewModel+Recording.swift */, 8465FD182746A95600AF091E /* PhotoAssetsUtils.swift */, - 844CC60D2811378D0006548D /* ComposerConfig.swift */, + 8465FD1D2746A95600AF091E /* PhotoAttachmentPickerView.swift */, + 84DEC8EB27611CAE00172876 /* SendInChannelView.swift */, + 8465FD122746A95600AF091E /* SendMessageButton.swift */, + 8492975127B156D000A8EEB0 /* SlowModeView.swift */, + 84EADEB12B2883C60046B50C /* TrailingComposerView.swift */, ); path = Composer; sourceTree = "";