mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Wrap becomeFirstResponder in async dispatch
This fixes issues when we’re updating the responder chain every time SwiftUI refreshes the view, which can have unpredictable side effects.
This commit is contained in:
parent
1361ff7586
commit
6e60e0ded5
@ -41,8 +41,10 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
|||||||
uiView.text = self.text
|
uiView.text = self.text
|
||||||
}
|
}
|
||||||
|
|
||||||
if uiView.window != nil, isEditing {
|
if uiView.window != nil && isEditing {
|
||||||
uiView.becomeFirstResponder()
|
DispatchQueue.main.async {
|
||||||
|
uiView.becomeFirstResponder()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UITextViewWrapper.recalculateHeight(view: uiView, result: $calculatedHeight)
|
UITextViewWrapper.recalculateHeight(view: uiView, result: $calculatedHeight)
|
||||||
|
Loading…
Reference in New Issue
Block a user