You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
A component which takes HTML content and renders it as native views.
Props
value: a string of HTML content to render
onLinkPress: a function which will be called with a url when a link is pressed.Passing this prop will override how links are handled (defaults to callingLinking.openURL(url))
stylesheet: a stylesheet object keyed by tag name, which will override thestyles applied to those respective tags.
renderNode: a custom function to render HTML nodes however you see fit. Ifthe function returnsundefined (notnull), the default renderer will beused for that node.
example
importReact,{Component}from'react'importReactNativefrom'react-native'const{ Text, View, ListView}=ReactNativeconstHTMLView=require('react-native-html2native')classAppextendsComponent{render(){constcontent='<p><a href="http://google.com">Google it FTW!</a></p>'return(<HTMLViewvalue={content}stylesheet={styles}/>)}})conststyles=StyleSheet.create({a:{fontWeight:'300',color:'#FF0000'}})
When a link is clicked, by defaultReactNative.Linking.openURL is called with thelink url. You can customise what happens when a link is clicked withonLinkPress: