react-native-htmlview
react-native-htmlview copied to clipboard
can we define specific class?
Hi,
In react-native-htmlview, can we define specific classname?
For example I want to use "header-caption" class as a style.
In your renderNode property method you can use a method like this:
const elementAndClassPresent = (node, tag, className) => {
const attr = node.attribs
return (node.name === tag && typeof attr.class !== 'undefined' && attr.class.includes(className))
}
to do something like this:
if(elementsParentClassPresent(node, 'li','arrows')){
// console.log(node)
return(
<Text key={index}>
<Text style={{color: green, fontSize: 25}}>{'\u203A'}</Text>
<Text>{defaultRenderer(node.children, parent)}</Text>
{'\n'}
{'\n'}
</Text>
)
}
https://github.com/jsdf/react-native-htmlview/issues/120