@native-html/table-plugin@3.0.0
·
182 commits
to master
since this release
This release requires react-native-render-html
≥ 5.0.0! Be aware, its API has changed a little:
import React from 'react';
import { ScrollView } from 'react-native';
import HTML from 'react-native-render-html';
import table, { IGNORED_TAGS } from '@native-html/table-plugin';
import WebView from 'react-native-webview';
const html = `
<table>
<tr>
<th>Entry Header 1</th>
<th>Entry Header 2</th>
</tr>
<tr>
<td>Entry First Line 1</td>
<td>Entry First Line 2</td>
</tr>
</table>
`;
const htmlProps = {
WebView,
renderers: {
table
},
ignoredTags: IGNORED_TAGS,
renderersProps: {
table: {
// Put the table config here (previously,
// the first argument of makeTableRenderer)
}
}
};
export const Example = () => (
<ScrollView>
<HTML source={{ html }} {...htmlProps} />
</ScrollView>
);
Features
- table-plugin: new lightweight API for react-native-render-html v5.0 (a7fa70a)
- table-plugin: new displayMode prop and compliance with RFC001 (1de3df0)
- table-plugin: the component now inherits from
tagsStyles
andclassesStyles
when matched
BREAKING CHANGES
- table-plugin:
makeTableRenderer
andmakeCustomTableRenderer
have been dropped in favor of the defaulttable
renderer export andextractHtmlTableProp
function for custom renderers. This release takes advantage of the availability ofdomNode
in custom renderers and the newdomNodeToHTMLString
utility available in react-native-render-html. Configuration for the table renderer is now read from
renderersProps.table
prop of theHTML
component.