Add NAN check for text font sizeMultiplier (#24966)

Summary:
Set `sizeMultiplier` to `1.0` if default value is `NAN`, otherwise, text cannot show properly.

## Changelog

[iOS] [Fixed] - Add NAN check for text font sizeMultiplier
Pull Request resolved: https://github.com/facebook/react-native/pull/24966

Differential Revision: D15466559

Pulled By: shergin

fbshipit-source-id: 6f8b47eb8e521cb120d7f351cba02dbf1c5411fd
This commit is contained in:
zhongwuzw 2019-05-22 22:50:17 -07:00 коммит произвёл Facebook Github Bot
Родитель b355ba56db
Коммит 3616941ef8
2 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -154,6 +154,7 @@ TextAttributes TextAttributes::defaultTextAttributes() {
textAttributes.foregroundColor = blackColor();
textAttributes.backgroundColor = clearColor();
textAttributes.fontSize = 14.0;
textAttributes.fontSizeMultiplier = 1.0;
return textAttributes;
}();
return textAttributes;

Просмотреть файл

@ -137,6 +137,7 @@ UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties) {
RCTFontProperties defaultFontProperties = RCTDefaultFontProperties();
fontProperties = RCTResolveFontProperties(fontProperties);
assert(!isnan(fontProperties.sizeMultiplier));
CGFloat effectiveFontSize =
fontProperties.sizeMultiplier * fontProperties.size;
UIFont *font;