From 665bdd191fe0164f1f6623d8dc7d117948d5d259 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 24 Oct 2024 14:04:36 +0300 Subject: [PATCH] Fix #3369 - Composer mention pills showing up as file icons on first use on iOS 18 --- .../ComposerToolbar/View/MessageComposerTextField.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift index a1f73a0011..458e382d9c 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift @@ -110,6 +110,11 @@ private struct UITextViewWrapper: UIViewRepresentable { // Remember the selection if only the attributes have changed. let selection = textView.attributedText.string == text.string ? textView.selectedTextRange : nil + // Fixes pill views not loading on the first attempt on iOS 18 + // because the textContainers's superview comes in as nil + // https://github.com/element-hq/element-x-ios/issues/3369 + _ = textView.layoutManager + textView.attributedText = text // Re-apply the default font when setting text for e.g. edits.