Prevent the textView from inheriting attributes from mention pills

This commit is contained in:
Stefan Ceriu
2024-05-07 10:21:02 +03:00
committed by Stefan Ceriu
parent 17b79c1e80
commit 5a28532e90
@@ -88,6 +88,10 @@ private struct UITextViewWrapper: UIViewRepresentable {
}
func updateUIView(_ textView: UITextView, context: UIViewRepresentableContext<UITextViewWrapper>) {
// 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