jsdf / react-native-htmlview

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

Custom function to renderNode #260

Open Aung-Myint-Thein opened 5 years ago

Aung-Myint-Thein commented 5 years ago

Is there a way to inject custom function renderNode? My use case is that I am rendering an iframe node in renderNode but I would like to add a custom function so that I can record onPress.

function renderNode(node, index, siblings, parent, defaultRenderer) {
  if (node.name === 'iframe') {
    const a = node.attribs;

    return (
      <Video 
        src={a.src}
        // revealVideo={???} <<---- I would like to pass a function to my own Video component
      />
    );
  }
}

const articleContent = props => {
  return ( 
    <HTMLView
      value={ props.content }
      stylesheet={styles}
      renderNode={renderNode}
    /> 
  );
}   

Thanks.