File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Sources/StreamChatSwiftUI/ChatChannel/Composer Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,7 @@ open class MessageComposerViewModel: ObservableObject {
9696 didSet {
9797 if oldValue? . id != composerCommand? . id &&
9898 composerCommand? . displayInfo? . isInstant == true {
99- // This is needed because of autocompleting text from the keyboard.
100- // The update of the text is done in the next cycle, so it overrides
101- // the setting of this value to empty string.
102- DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.01 ) { [ weak self] in
103- self ? . text = " "
104- }
99+ clearText ( )
105100 }
106101 if oldValue != nil && composerCommand == nil {
107102 pickerTypeState = . expanded( . none)
@@ -422,6 +417,7 @@ open class MessageComposerViewModel: ObservableObject {
422417 addedFileURLs = [ ]
423418 addedCustomAttachments = [ ]
424419 composerCommand = nil
420+ clearText ( )
425421 }
426422
427423 private func checkPickerSelectionState( ) {
@@ -495,4 +491,13 @@ open class MessageComposerViewModel: ObservableObject {
495491 timer? . fire ( )
496492 }
497493 }
494+
495+ private func clearText( ) {
496+ // This is needed because of autocompleting text from the keyboard.
497+ // The update of the text is done in the next cycle, so it overrides
498+ // the setting of this value to empty string.
499+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.1 ) { [ weak self] in
500+ self ? . text = " "
501+ }
502+ }
498503}
You can’t perform that action at this time.
0 commit comments