Permalink
Browse files

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 #10483

Differential Revision: D5128581

Pulled By: shergin

fbshipit-source-id: 21b1ddd35210c8f061506d71b936cc0ff490d999
  • Loading branch information...
davidlrnt authored and facebook-github-bot committed May 25, 2017
1 parent eac399b commit 7cddaa02d6c7cf9b9c79051299347feb390c26ad
Showing with 2 additions and 1 deletion.
  1. +2 −1 Libraries/ART/ReactNativeART.js
@@ -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';

This comment has been minimized.

Show comment
Hide comment
@chirag04

chirag04 May 25, 2017

Collaborator

y default to 400 tho?

@chirag04

chirag04 May 25, 2017

Collaborator

y default to 400 tho?

return {
// Normalize
fontFamily: fontFamily,
fontSize: fontSize,
fontWeight: font.fontWeight,
fontWeight: fontWeight,
fontStyle: font.fontStyle,
};
}

0 comments on commit 7cddaa0

Please sign in to comment.