question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Font-size should be of type string, not number

See original GitHub issue

When I pass fontSize: "0.875rem" to the axis.ticks property in theme, I get the following warning:

Warning: Failed prop type: Invalid prop theme.axis.ticks.text.fontSize of type string supplied to Axes, expected number.

However, font-size should really be of type string. A number has no unit (px/em/rem/etc.) information; the assumption it should be px is faulty.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JelleBlaauwcommented, May 9, 2019

But shouldn’t the warning only appear when using canvas, then? Because I use svg. Also, for non-svg solutions, perhaps it would be an idea to support both number and string variants, where the string variant would be converted to the px version.

0reactions
stale[bot]commented, Nov 5, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invariant Violation: invalid prop 'fontSize' of type 'string ...
Every time I run it, it throws an error 'stylesheet generated value as a string, but expected is number'. When I look into...
Read more >
String.prototype.fontsize() - JavaScript - MDN Web Docs
The fontsize() method creates a string that embeds a string in a element (str), ... Deprecated: This feature is no longer recommended.
Read more >
JavaScript String fontsize() Method - W3Schools
The fontsize() method returns a string embedded in a <font> tag: <font size="size">string</font>. The <font> tag is not supported in HTML5.
Read more >
Fonts in .NET MAUI - Microsoft Learn
All controls that display text define properties that can be set to change font appearance: FontFamily , of type string .
Read more >
TypeScript and React Native Are the type definitions for RN ...
Type 'RegisteredStyle<{ color: string; fontWeight: string; fontSize?: undefined; padding: number; textAlign: "center"; } | { color: string; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found