react-native-htmlview icon indicating copy to clipboard operation
react-native-htmlview copied to clipboard

can we define specific class?

Open gunduzcihat opened this issue 6 years ago • 2 comments

Hi,

In react-native-htmlview, can we define specific classname?

For example I want to use "header-caption" class as a style.

gunduzcihat avatar Mar 25 '19 14:03 gunduzcihat

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>
        )
    }

djarrin avatar Mar 27 '19 19:03 djarrin

https://github.com/jsdf/react-native-htmlview/issues/120

rochapablo avatar May 29 '19 16:05 rochapablo