react native render html code example
Example 1: html to react native
import React, { Component } from 'react';
import { WebView } from 'react-native';
class MyInlineWeb extends Component {
render() {
return (
<WebView
originWhitelist={['*']}
source={{ html: '<h1>Hello world</h1>' }}
/>
);
}
}
Example 2: render html view react native
npm install react-native-htmlview --save
Example 3: react native render html not rerender
your need to add some key to attribute key={index} that force re-render
<HTML key={index} html={htmlContent} imagesMaxWidth={Dimensions.get('window').width} />