Skip to content

Commit 0df1000

Browse files
fix(textinput): Account for float dimensions when showing scroller (#2341)
* Account for float dimensions when showing scroller * Use fabs() --------- Co-authored-by: Saad Najmi <[email protected]>
1 parent 8cc0520 commit 0df1000

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/react-native/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ - (BOOL)shouldShowVerticalScrollbar
134134
CGSize textViewSize = [_backedTextInputView intrinsicContentSize];
135135
NSClipView *clipView = (NSClipView *)_scrollView.contentView;
136136
if (textViewSize.height > clipView.bounds.size.height) {
137-
return YES;
137+
// Sometimes dimensions returned are in floating point numbers.
138+
// If the floats are close enough, then don't show the scrollbar even if there is a fraction of overflow with the text.
139+
return fabs(textViewSize.height - clipView.bounds.size.height) >= 1;
138140
};
139141

140142
return NO;

0 commit comments

Comments
 (0)