mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Report error if font size value is zero or negative
Summary: Text font size should not be negative, this diff throws an exception if TextView uses negative of zero font size Changelog: [[internal]] Reviewed By: shergin Differential Revision: D18068071 fbshipit-source-id: 4074dca2019b6223eef68a407570258adbceaa43
This commit is contained in:
committed by
Facebook Github Bot
parent
002d3c179d
commit
d9f7f99d91
@@ -204,6 +204,10 @@ public class TextAttributeProps {
|
||||
? PixelUtil.toPixelFromSP(mLetterSpacingInput)
|
||||
: PixelUtil.toPixelFromDIP(mLetterSpacingInput);
|
||||
|
||||
if (mFontSize <= 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"FontSize should be a positive value. Current value: " + mFontSize);
|
||||
}
|
||||
// `letterSpacingPixels` and `mFontSize` are both in pixels,
|
||||
// yielding an accurate em value.
|
||||
return letterSpacingPixels / mFontSize;
|
||||
|
||||
Reference in New Issue
Block a user