diff --git a/ios/sdk/component/textinput/HippyTextView.mm b/ios/sdk/component/textinput/HippyTextView.mm index ac22c4bfbf8..901ab3e4387 100644 --- a/ios/sdk/component/textinput/HippyTextView.mm +++ b/ios/sdk/component/textinput/HippyTextView.mm @@ -301,21 +301,23 @@ - (void)updateFrames { } - (void)updateContentSize { - CGSize size = (CGSize) { _scrollView.frame.size.width, INFINITY }; - size.height = [_textView sizeThatFits:size].height; - _scrollView.contentSize = size; - _textView.frame = (CGRect) { CGPointZero, size }; - - if (_viewDidCompleteInitialLayout && _onContentSizeChange && !CGSizeEqualToSize(_previousContentSize, size)) { - _previousContentSize = size; + CGSize contentSize = (CGSize) { CGRectGetMaxX(_scrollView.frame), INFINITY }; + contentSize.height = [_textView sizeThatFits:contentSize].height; + + if (_viewDidCompleteInitialLayout && _onContentSizeChange && !CGSizeEqualToSize(_previousContentSize, contentSize)) { + _previousContentSize = contentSize; _onContentSizeChange(@{ @"contentSize": @ { - @"height": @(size.height), - @"width": @(size.width), + @"height": @(contentSize.height), + @"width": @(contentSize.width), }, @"target": self.hippyTag, }); } + + CGSize viewSize = CGSizeMake(CGRectGetWidth(_scrollView.frame), MAX(contentSize.height, self.frame.size.height)); + _scrollView.contentSize = viewSize; + _textView.frame = (CGRect) { CGPointZero, viewSize }; } - (void)updatePlaceholder {