Skip to content

Commit

Permalink
Revert "Attempted fix for #2653 - Reset the TextView delegates on eve…
Browse files Browse the repository at this point in the history
…ry update call"

This reverts commit 9b9deb7.
  • Loading branch information
stefanceriu committed Apr 24, 2024
1 parent d949b17 commit 2378bb6
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ private struct UITextViewWrapper: UIViewRepresentable {
// Need to use TextKit 1 for mentions
let textView = ElementTextView(usingTextLayoutManager: false)
textView.isMultiline = $isMultiline
textView.delegate = context.coordinator
textView.elementDelegate = context.coordinator
textView.textColor = .compound.textPrimary
textView.isEditable = true
textView.font = font
Expand All @@ -73,9 +75,6 @@ private struct UITextViewWrapper: UIViewRepresentable {
textView.keyboardType = .default

textView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)

textView.delegate = context.coordinator
textView.elementDelegate = context.coordinator

return textView
}
Expand All @@ -91,14 +90,6 @@ private struct UITextViewWrapper: UIViewRepresentable {
}

func updateUIView(_ textView: UITextView, context: UIViewRepresentableContext<UITextViewWrapper>) {
// Attempted fix for element-hq/element-x-ios/issues/2653 which we can't reproduce
// but it feels like the degate doesn't get called and the binding doesn't update upwards
// The textView is changed but none of the UI depending on the binding are.
if let textView = textView as? ElementTextView {
textView.delegate = context.coordinator
textView.elementDelegate = context.coordinator
}

if textView.text != text {
textView.text = text

Expand Down

0 comments on commit 2378bb6

Please sign in to comment.