jsdf / react-native-htmlview

A React Native component which renders HTML content as native views
ISC License
2.71k stars 467 forks source link

Adding styles to tags without overriding default styles #182

Open zachdixon opened 6 years ago

zachdixon commented 6 years ago

Using the stylesheet prop, if I pass in custom styles for a tag, it overrides the default styles. For instance:

...
stylesheet={{
    h1: {color: "#333"}
}}

This works fine but removes the fontSize that I'd like to keep. Same for strong, em, u, etc. Am I doing something wrong or is there a better way of doing this? My ultimate goal is to just change the text color of all elements and it would be kind of annoying to have to restyle everything.

zachdixon commented 6 years ago

I figured out how to give all text a color via textComponentProps so that's working now at least. It would still be nice if the default styles extended any custom styles given though rather than being overridden. Or is that the desired behavior?

richchurcher commented 6 years ago

Hrm. I don't think it's desired so much as the way it works right now :smile: if you can think of a good way to implement this, PRs are definitely welcome!