html render react native 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: 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} />