From 5a28532e900ac1105e0b0bd6273700e4da1a46b8 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 7 May 2024 10:21:02 +0300 Subject: [PATCH] Prevent the textView from inheriting attributes from mention pills --- .../ComposerToolbar/View/MessageComposerTextField.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift index 3b38acb98..601de08a4 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift @@ -88,6 +88,10 @@ private struct UITextViewWrapper: UIViewRepresentable { } func updateUIView(_ textView: UITextView, context: UIViewRepresentableContext) { + // Prevent the textView from inheriting attributes from mention pills + textView.typingAttributes = [.font: font, + .foregroundColor: UIColor(.compound.textPrimary)] + if textView.attributedText != text { textView.attributedText = text @@ -95,10 +99,6 @@ private struct UITextViewWrapper: UIViewRepresentable { textView.font = font textView.textColor = .compound.textPrimary - // Prevent the textView from randomly using the tint color - textView.typingAttributes = [.font: font, - .foregroundColor: UIColor(.compound.textPrimary)] - if text.string.isEmpty { // text cleared, probably because the written text is sent // reload keyboard type