Fix crash when opening Compose screen on iOS 13

This commit is contained in:
Shadowfacts 2020-09-06 23:27:43 -04:00
parent 262aadf807
commit ec2d510be2
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 3 additions and 1 deletions

View File

@ -145,8 +145,10 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
context.coordinator.uiState = uiState
if becomeFirstResponder {
uiView.becomeFirstResponder()
DispatchQueue.main.async {
// calling becomeFirstResponder during the SwiftUI update causes a crash on iOS 13
uiView.becomeFirstResponder()
// can't update @State vars during the SwiftUI update
becomeFirstResponder = false
}
}