From 613bf0a29dc3c68525fa8f1c193aa2e4e7350720 Mon Sep 17 00:00:00 2001 From: Fabrizio Bertoglio Date: Tue, 30 May 2023 10:48:10 +0800 Subject: [PATCH] changes requested in code review https://github.com/Expensify/react-native/pull/57#discussion_r1209482669 --- .../Text/TextInput/Singleline/RCTUITextField.m | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.m b/packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.m index 95971c93926366..74b56fb289efc6 100644 --- a/packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.m +++ b/packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.m @@ -167,13 +167,9 @@ - (CGRect)textRectForBounds:(CGRect)bounds CGFloat leftPadding = _textContainerInset.left + _textBorderInsets.left; CGFloat rightPadding = _textContainerInset.right + _textBorderInsets.right; 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); - } + // The fragmentViewContainerBounds set the correct y coordinates for + // _UITextLayoutFragmentView to fix an iOS UITextField issue with lineHeight. + return UIEdgeInsetsInsetRect([super textRectForBounds:self.fragmentViewContainerBounds.size.height > 0 ? self.fragmentViewContainerBounds : bounds], borderAndPaddingInsets); } - (CGRect)editingRectForBounds:(CGRect)bounds