Fix keyboard reappearing after pressing Post button on Compose screen

This commit is contained in:
Shadowfacts 2022-11-12 13:52:36 -05:00
parent 072a77b58e
commit de0198946e
2 changed files with 6 additions and 0 deletions

View File

@ -69,6 +69,8 @@ struct WrappedTextView: UIViewRepresentable {
var textDidChange: ((UITextView) -> Void)?
var font = UIFont.systemFont(ofSize: 20)
@Environment(\.isEnabled) private var isEnabled: Bool
func makeUIView(context: Context) -> UITextView {
let textView = UITextView()
textView.delegate = context.coordinator
@ -82,6 +84,7 @@ struct WrappedTextView: UIViewRepresentable {
func updateUIView(_ uiView: UITextView, context: Context) {
uiView.text = text
uiView.isEditable = isEnabled
context.coordinator.textView = uiView
context.coordinator.text = $text
context.coordinator.didChange = textDidChange

View File

@ -78,6 +78,7 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
@EnvironmentObject var uiState: ComposeUIState
@EnvironmentObject var mastodonController: MastodonController
@Environment(\.isEnabled) var isEnabled: Bool
func makeUIView(context: Context) -> UITextView {
let textView = WrappedTextView()
@ -98,6 +99,8 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
uiView.text = text
}
uiView.isEditable = isEnabled
context.coordinator.text = $text
context.coordinator.didChange = textDidChange
context.coordinator.uiState = uiState