classesStyles properties don't override baseFontStyle properties
See original GitHub issueclassesStyles
properties override the corresponding baseFontStyle
properties only if the tagsStyles have the same properties.
For example:
<HTML
html={'Just text <p>Normal paragraph</p><p class="smallRedFont">Small red paragraph</p>'}
baseFontStyle={{ fontSize: 20, color: 'green' }}
tagsStyles={{ p: { lineHeight: 30 } }}
classesStyles={{ smallRedFont: { fontSize: 10, color: 'red' } }}
/>
fontSize
and color
properties of smallRedFont
class won’t override fontSize
and color
of baseFontStyle
, because tagsStyles
for p
doesn’t include these properties.
In this case, however,
<HTML
html={'Just text <p>Normal paragraph</p><p class="smallRedFont">Small red paragraph</p>'}
baseFontStyle={{ fontSize: 20, color: 'green' }}
tagsStyles={{ p: { fontSize: 16, color: 'blue' } }}
classesStyles={{ smallRedFont: { fontSize: 10, color: 'red' } }}
/>
fontSize
and color
properties of smallRedFont
class will override fontSize
and color
of baseFontStyle
, because tagsStyles
for p
does have these properties.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
classesStyles properties don't override baseFontStyle ... - GitHub
classesStyles properties override the corresponding baseFontStyle properties only if the tagsStyles have the same properties.
Read more >Issue overriding application properties in Spring-boot (profile ...
I'm having difficulty trying to override a property declared in a profile-specific application properties file on the classpath with another ...
Read more >Migrating to v6 | React Native Render HTML
V6 is a brand new rewrite of the library, bringing amazing new features such as whitespace collapsing, ... allowedStyles, CSS properties are now...
Read more >react-native-render-html - npm
If you have some property both in allowedStyles and ignoredStyles , it will be ignored anyway. array, Optional, everything is allowed by default....
Read more >Override Properties in Spring's Tests - Baeldung
Now we'll override properties by putting the property file in the test resources. This file must be on the same classpath as the...
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 FreeTop 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
Top GitHub Comments
Hi, thanks for the very precise explanation and reproduction of this issue.
Could you try replacing the line 444 from
HTML.js
from :
to
Basically, what I’ve done here is not to apply
baseFontStyle
to text nodes nested inside other text nodes, since the parent should be the one receiving the style anyway.I’m pretty concerned with regressions, and the demo isn’t complete enough for me to check all use cases. I’d like you to tell me if it fixed it for you, and if you see any potential drawbacks.
Holy moly, I think I’m getting there. I’ll create a separate branch so you can take a look at it and test it yourselves. This won’t be part of the next release since this is quite a major rewrite.