diff --git a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m index c79d65e136f88f..c6cc08bb8bf0f3 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m @@ -174,7 +174,12 @@ - (void)uiManagerWillPerformMounting baseTextInputView.reactPaddingInsets = paddingInsets; if (isAttributedTextChanged) { - baseTextInputView.attributedText = attributedText; + // Don't set `attributedText` if length equal to zero, otherwise it would shrink when attributes contain like `lineHeight`. + if (attributedText.length != 0) { + baseTextInputView.attributedText = attributedText; + } else { + baseTextInputView.attributedText = nil; + } } }]; } diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.h b/Libraries/Text/TextInput/RCTBaseTextInputView.h index 5b62f90251492e..ead709672f8f9a 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.h +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.h @@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) BOOL secureTextEntry; @property (nonatomic, copy) RCTTextSelection *selection; @property (nonatomic, strong, nullable) NSNumber *maxLength; -@property (nonatomic, copy) NSAttributedString *attributedText; +@property (nonatomic, copy, nullable) NSAttributedString *attributedText; @property (nonatomic, copy) NSString *inputAccessoryViewID; @property (nonatomic, assign) UIKeyboardType keyboardType;