Skip to content

Commit

Permalink
fix internal FB linter issue
Browse files Browse the repository at this point in the history
The diff would trigger linter error internal in Facebook. I compared
the commit and the original diff and I was able to identify the linter
issue. I fixed the linter issue to avoid again failures when importing
it.

Comment
facebook#37465 (comment)

Imported in Facebook
facebook@35a1648#diff-08824b4f7ca9c31bd2a7aeb8b1180bd55b2b834d99667861e14e59082d06c137R179-R190

Original Diff
facebook@c4996fc#diff-08824b4f7ca9c31bd2a7aeb8b1180bd55b2b834d99667861e14e59082d06c137R170-R177
  • Loading branch information
fabOnReact committed Jul 9, 2023
1 parent 0adeebb commit b2e83de
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,15 @@ - (CGRect)textRectForBounds:(CGRect)bounds
// Text is vertically aligned to the center.
CGFloat leftPadding = _textContainerInset.left + _textBorderInsets.left;
CGFloat rightPadding = _textContainerInset.right + _textBorderInsets.right;
UIEdgeInsets borderAndPaddingInsets = UIEdgeInsetsMake(_textContainerInset.top, leftPadding, _textContainerInset.bottom, rightPadding);

// The fragmentViewContainerBounds set the correct y coordinates for
// _UITextLayoutFragmentView to fix an iOS UITextField issue with lineHeight.
CGRect updatedBounds = self.fragmentViewContainerBounds.size.height > 0 ? self.fragmentViewContainerBounds : bounds;
return UIEdgeInsetsInsetRect([super textRectForBounds:updatedBounds], borderAndPaddingInsets);
UIEdgeInsets borderAndPaddingInsets =
UIEdgeInsetsMake(_textContainerInset.top, leftPadding, _textContainerInset.bottom, rightPadding);
if (self.fragmentViewContainerBounds.size.height > 0) {
// apply custom bounds to fix iOS UITextField issue with lineHeight
// sets the correct y coordinates for _UITextLayoutFragmentView
return UIEdgeInsetsInsetRect([super textRectForBounds:self.fragmentViewContainerBounds], borderAndPaddingInsets);
} else {
return UIEdgeInsetsInsetRect([super textRectForBounds:bounds], borderAndPaddingInsets);
}
}

- (CGRect)editingRectForBounds:(CGRect)bounds
Expand Down

0 comments on commit b2e83de

Please sign in to comment.