Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call toString on fontWeight else throws error if passed an integer #10483

Closed
wants to merge 8 commits into from

Conversation

davidlrnt
Copy link
Contributor

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.

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @spicyj and @davidaurelio to be potential reviewers.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired.

Before we can review or merge your code, we need you to email cla@fb.com with your details so we can update your status.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Oct 20, 2016
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@ide
Copy link
Contributor

ide commented Oct 20, 2016

This is going to break if someone doesn't specify a font weight -- can you handle those cases gracefully too?

@facebook-github-bot
Copy link
Contributor

@davidlrnt updated the pull request - view changes

@davidlrnt
Copy link
Contributor Author

@ide udpated!

@@ -439,11 +439,12 @@ function extractFont(font) {
}
var fontFamily = extractSingleFontFamily(font.fontFamily);
var fontSize = +font.fontSize || 12;
var fontWeight = font.fontWeight ? font.fontWeight.toString() : "400";
return {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quotes: Strings must use singlequote.

@facebook-github-bot
Copy link
Contributor

@davidlrnt updated the pull request - view changes

1 similar comment
@facebook-github-bot
Copy link
Contributor

@davidlrnt updated the pull request - view changes

@facebook-github-bot
Copy link
Contributor

@davidlrnt updated the pull request - view changes

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 21, 2016
@@ -439,11 +439,12 @@ function extractFont(font) {
}
var fontFamily = extractSingleFontFamily(font.fontFamily);
var fontSize = +font.fontSize || 12;
var fontWeight = font.fontWeight ? font.fontWeight.toString() : '400';
return {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i set fontWeight to 0, it will fallback to 400, so i think it's better using font.fontWeight != null ? font.fontWeight.toString() : '400'

@hramos
Copy link
Contributor

hramos commented Nov 7, 2016

Ping @davidlrnt there seems to be some additional feedback here before the PR can be approved.

@davidlrnt
Copy link
Contributor Author

Updated after additional feedback

@hramos
Copy link
Contributor

hramos commented Jan 19, 2017

Do you know why the tests aren't passing?

@facebook-github-bot facebook-github-bot added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. labels May 25, 2017
@facebook-github-bot
Copy link
Contributor

@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

chnfeeeeeef pushed a commit to chnfeeeeeef/react-native that referenced this pull request May 31, 2017
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 facebook#10483

Differential Revision: D5128581

Pulled By: shergin

fbshipit-source-id: 21b1ddd35210c8f061506d71b936cc0ff490d999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants