From 2535a1e67d46bf12275e450255dc5694f32af5d6 Mon Sep 17 00:00:00 2001 From: Mike Olson Date: Sun, 4 Oct 2026 15:06:05 -0400 Subject: [PATCH] fix(mobile): Keep the last line of iOS markdown replies visible iOS markdown rows could draw one line short, leaving blank space where the last line of a paragraph belonged. The text view's container followed the view's frame, which pixel rounding can leave a fraction of a point shorter than the text the shadow node measured, and TextKit drops a final line that does not fully fit. Size the container by hand with unbounded height so the view's bounds do the clipping. --- apps/mobile/modules/t3-markdown-text/ios/T3MarkdownText.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/mobile/modules/t3-markdown-text/ios/T3MarkdownText.mm b/apps/mobile/modules/t3-markdown-text/ios/T3MarkdownText.mm index 8fa5abfe2a8e..c0db129ee8c8 100644 --- a/apps/mobile/modules/t3-markdown-text/ios/T3MarkdownText.mm +++ b/apps/mobile/modules/t3-markdown-text/ios/T3MarkdownText.mm @@ -311,6 +311,12 @@ - (instancetype)initWithFrame:(CGRect)frame _textView.editable = false; _textView.textContainerInset = UIEdgeInsetsZero; _textView.textContainer.lineFragmentPadding = 0; + // The shadow node already sized this view to fit every line. A container + // that tracks the frame can come out a fraction of a point shorter after + // pixel rounding, and TextKit then drops the last line. Size it by hand + // with unbounded height and let the view's bounds clip. + _textView.textContainer.widthTracksTextView = NO; + _textView.textContainer.heightTracksTextView = NO; _textView.delegate = self; // Chat text supports selection and contextual actions, but not drag-and-drop. _textView.textDragInteraction.enabled = NO; @@ -477,6 +483,7 @@ - (void)drawRect:(CGRect)rect } if (frameChanged) { _textView.frame = _view.frame; + _textView.textContainer.size = CGSizeMake(CGRectGetWidth(_view.frame), CGFLOAT_MAX); } // Text attachments have no native link element. Expose their existing runs