mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Don't apply empty attributed string for TextInput (#25143)
Summary: Issue reported by Titozzz , `TextInput` would shrink when we have attributes like `lineHeight`. Demonstration can see GIF like below: https://giphy.com/gifs/KGNs1qIMHF3DIk1EPK I think the reason is we apply an empty attributed string to `UITextField`, now if the length is 0, we just nil the `attributedText` instead. ## Changelog [iOS] [Fixed] - Don't apply empty attributed string for TextInput Pull Request resolved: https://github.com/facebook/react-native/pull/25143 Differential Revision: D15661751 Pulled By: sammy-SC fbshipit-source-id: 9770484a1b68a6409e63ea25ac9a6fd0d3589b14
This commit is contained in:
committed by
Facebook Github Bot
parent
63bc4b4aac
commit
9b61896f40
@@ -174,7 +174,12 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user