Fix keyboard reappearing after pressing Post button on Compose screen
This commit is contained in:
parent
072a77b58e
commit
de0198946e
|
@ -69,6 +69,8 @@ struct WrappedTextView: UIViewRepresentable {
|
||||||
var textDidChange: ((UITextView) -> Void)?
|
var textDidChange: ((UITextView) -> Void)?
|
||||||
var font = UIFont.systemFont(ofSize: 20)
|
var font = UIFont.systemFont(ofSize: 20)
|
||||||
|
|
||||||
|
@Environment(\.isEnabled) private var isEnabled: Bool
|
||||||
|
|
||||||
func makeUIView(context: Context) -> UITextView {
|
func makeUIView(context: Context) -> UITextView {
|
||||||
let textView = UITextView()
|
let textView = UITextView()
|
||||||
textView.delegate = context.coordinator
|
textView.delegate = context.coordinator
|
||||||
|
@ -82,6 +84,7 @@ struct WrappedTextView: UIViewRepresentable {
|
||||||
|
|
||||||
func updateUIView(_ uiView: UITextView, context: Context) {
|
func updateUIView(_ uiView: UITextView, context: Context) {
|
||||||
uiView.text = text
|
uiView.text = text
|
||||||
|
uiView.isEditable = isEnabled
|
||||||
context.coordinator.textView = uiView
|
context.coordinator.textView = uiView
|
||||||
context.coordinator.text = $text
|
context.coordinator.text = $text
|
||||||
context.coordinator.didChange = textDidChange
|
context.coordinator.didChange = textDidChange
|
||||||
|
|
|
@ -78,6 +78,7 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
|
||||||
|
|
||||||
@EnvironmentObject var uiState: ComposeUIState
|
@EnvironmentObject var uiState: ComposeUIState
|
||||||
@EnvironmentObject var mastodonController: MastodonController
|
@EnvironmentObject var mastodonController: MastodonController
|
||||||
|
@Environment(\.isEnabled) var isEnabled: Bool
|
||||||
|
|
||||||
func makeUIView(context: Context) -> UITextView {
|
func makeUIView(context: Context) -> UITextView {
|
||||||
let textView = WrappedTextView()
|
let textView = WrappedTextView()
|
||||||
|
@ -98,6 +99,8 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
|
||||||
uiView.text = text
|
uiView.text = text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uiView.isEditable = isEnabled
|
||||||
|
|
||||||
context.coordinator.text = $text
|
context.coordinator.text = $text
|
||||||
context.coordinator.didChange = textDidChange
|
context.coordinator.didChange = textDidChange
|
||||||
context.coordinator.uiState = uiState
|
context.coordinator.uiState = uiState
|
||||||
|
|
Loading…
Reference in New Issue