mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-11 13:59:13 +00:00
Reset keyboard after message sent (#299)
This commit is contained in:
parent
05986cd785
commit
7a7680b165
@ -80,6 +80,7 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
|||||||
textView.returnKeyType = .default
|
textView.returnKeyType = .default
|
||||||
textView.textContainer.lineFragmentPadding = 0.0
|
textView.textContainer.lineFragmentPadding = 0.0
|
||||||
textView.textContainerInset = .zero
|
textView.textContainerInset = .zero
|
||||||
|
textView.keyboardType = .twitter
|
||||||
|
|
||||||
textView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
textView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||||
|
|
||||||
@ -89,6 +90,17 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
|||||||
func updateUIView(_ textView: UITextView, context: UIViewRepresentableContext<UITextViewWrapper>) {
|
func updateUIView(_ textView: UITextView, context: UIViewRepresentableContext<UITextViewWrapper>) {
|
||||||
if textView.text != text {
|
if textView.text != text {
|
||||||
textView.text = text
|
textView.text = text
|
||||||
|
|
||||||
|
if text.isEmpty {
|
||||||
|
// text cleared, probably because the written text is sent
|
||||||
|
// reload keyboard type
|
||||||
|
if textView.isFirstResponder {
|
||||||
|
textView.keyboardType = .default
|
||||||
|
textView.reloadInputViews()
|
||||||
|
textView.keyboardType = .twitter
|
||||||
|
textView.reloadInputViews()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UITextViewWrapper.recalculateHeight(view: textView, result: $calculatedHeight, maxHeight: maxHeight)
|
UITextViewWrapper.recalculateHeight(view: textView, result: $calculatedHeight, maxHeight: maxHeight)
|
||||||
|
1
changelog.d/269.bugfix
Normal file
1
changelog.d/269.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Timeline: Reset keyboard after a message is sent.
|
Loading…
x
Reference in New Issue
Block a user