Font-size should be of type string, not number
See original GitHub issueWhen 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.fontSizeof typestringsupplied toAxes, expectednumber.
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:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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
numberandstringvariants, where thestringvariant would be converted to thepxversion.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!