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 {
96
96
didSet {
97
97
if oldValue? . id != composerCommand? . id &&
98
98
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 ( )
105
100
}
106
101
if oldValue != nil && composerCommand == nil {
107
102
pickerTypeState = . expanded( . none)
@@ -422,6 +417,7 @@ open class MessageComposerViewModel: ObservableObject {
422
417
addedFileURLs = [ ]
423
418
addedCustomAttachments = [ ]
424
419
composerCommand = nil
420
+ clearText ( )
425
421
}
426
422
427
423
private func checkPickerSelectionState( ) {
@@ -495,4 +491,13 @@ open class MessageComposerViewModel: ObservableObject {
495
491
timer? . fire ( )
496
492
}
497
493
}
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
+ }
498
503
}
You can’t perform that action at this time.
0 commit comments