From 8d6c63d5e91fe510dc2939f89cc822a3a8deb3b5 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 23 Feb 2025 00:28:28 -0500 Subject: [PATCH] Fix compose main text view sizing on iOS 15 --- .../ComposeUI/Sources/ComposeUI/Views/NewMainTextView.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Packages/ComposeUI/Sources/ComposeUI/Views/NewMainTextView.swift b/Packages/ComposeUI/Sources/ComposeUI/Views/NewMainTextView.swift index 9eb42ce7..eccd7f77 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Views/NewMainTextView.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Views/NewMainTextView.swift @@ -19,6 +19,7 @@ struct NewMainTextView: View { var body: some View { NewMainTextViewRepresentable(value: $value, becomeFirstResponder: $becomeFirstResponder, handleAttachmentDrop: handleAttachmentDrop) + .frame(minHeight: Self.minHeight) .focused($focusedField, equals: .body) .modifier(FocusedInputModifier()) .overlay(alignment: .topLeading) { @@ -58,6 +59,10 @@ private struct NewMainTextViewRepresentable: UIViewRepresentable { .font: UIFontMetrics.default.scaledFont(for: .systemFont(ofSize: 20)), ] view.backgroundColor = nil + // on iOS 15, this is needed to prevent the text view from growing horizontally + if #unavailable(iOS 16.0) { + view.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + } // view.layer.cornerRadius = 5 // view.layer.cornerCurve = .continuous