Skip to content

Commit

Permalink
fix(ios): responsable region issue of Textinput
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg committed Jun 17, 2024
1 parent 041db25 commit 0c9d9de
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ios/sdk/component/textinput/HippyTextView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0c9d9de

Please sign in to comment.