Skip to content

Commit

Permalink
fix(textinput): Account for float dimensions when showing scroller (#…
Browse files Browse the repository at this point in the history
…2341)

* Account for float dimensions when showing scroller

* Use fabs()

---------

Co-authored-by: Saad Najmi <sanajmi@microsoft.com>
  • Loading branch information
lawrencewin and Saadnajmi authored Jan 22, 2025
1 parent 8cc0520 commit 0df1000
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ - (BOOL)shouldShowVerticalScrollbar
CGSize textViewSize = [_backedTextInputView intrinsicContentSize];
NSClipView *clipView = (NSClipView *)_scrollView.contentView;
if (textViewSize.height > clipView.bounds.size.height) {
return YES;
// Sometimes dimensions returned are in floating point numbers.
// If the floats are close enough, then don't show the scrollbar even if there is a fraction of overflow with the text.
return fabs(textViewSize.height - clipView.bounds.size.height) >= 1;
};

return NO;
Expand Down

0 comments on commit 0df1000

Please sign in to comment.