From 7b2a8eee036b784aab724496fa76d3ccf424271f Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Fri, 15 May 2026 02:04:16 -0700 Subject: [PATCH] Fix React Native multiline TextInput container overflow Summary: The text input field in the Marketplace Review Response Composer (and all React Native multiline TextInput instances) incorrectly expands beyond its container bounds. The _UITextLayoutFragmentView has a width that exceeds the RCTTextInputComponentView container width by 47 points. Root cause: RCTUITextView.layoutSubviews does not update self.textContainer.size when parent view bounds change. When RCTTextInputComponentView.updateLayoutMetrics sets a new frame and textContainerInset, the NSTextContainer.size inside the UITextView retains its old (wider) value. Fix: Add self.textContainer.size = CGSizeMake(textFrame.size.width, CGFLOAT_MAX) in layoutSubviews after computing textFrame, so the text container width stays in sync with container bounds. ## Changelog [iOS][Fixed] - Update text view bounding to avoid overflowing Differential Revision: D104896433 --- .../Libraries/Text/TextInput/Multiline/RCTUITextView.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm b/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm index cbda3771e97c..6b3a73938203 100644 --- a/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +++ b/packages/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm @@ -281,6 +281,11 @@ - (void)layoutSubviews [super layoutSubviews]; CGRect textFrame = UIEdgeInsetsInsetRect(self.bounds, self.textContainerInset); + + // Sync NSTextContainer.size with the current container bounds to prevent + // _UITextLayoutFragmentView from retaining a stale width after frame changes. + self.textContainer.size = CGSizeMake(textFrame.size.width, CGFLOAT_MAX); + CGFloat placeholderHeight = [_placeholderView sizeThatFits:textFrame.size].height; textFrame.size.height = MIN(placeholderHeight, textFrame.size.height); _placeholderView.frame = textFrame;