call toString on fontWeight else throws error if passed an integer

Summary:
expects a string, throws error NSNumber cannot be converted to NSString if passed an integer, added toString() method to allow integers, and keep consistency, fontSize allows int.
Closes https://github.com/facebook/react-native/pull/10483

Differential Revision: D5128581

Pulled By: shergin

fbshipit-source-id: 21b1ddd35210c8f061506d71b936cc0ff490d999
This commit is contained in:
david 2017-05-25 01:21:45 -07:00 committed by Facebook Github Bot
parent eac399b696
commit 7cddaa02d6

View File

@ -457,11 +457,12 @@ function extractFont(font) {
}
var fontFamily = extractSingleFontFamily(font.fontFamily);
var fontSize = +font.fontSize || 12;
var fontWeight = font.fontWeight != null ? font.fontWeight.toString() : '400';
return {
// Normalize
fontFamily: fontFamily,
fontSize: fontSize,
fontWeight: font.fontWeight,
fontWeight: fontWeight,
fontStyle: font.fontStyle,
};
}