Skip to content

@native-html/table-plugin@3.0.0

Compare
Choose a tag to compare
@jsamr jsamr released this 05 Dec 10:36
· 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 and classesStyles when matched

BREAKING CHANGES

  • table-plugin: makeTableRenderer and makeCustomTableRenderer have been dropped in favor of the default table renderer export and extractHtmlTableProp function for custom renderers. This release takes advantage of the availability of domNode in custom renderers and the new domNodeToHTMLString utility available in react-native-render-html. Configuration for the table renderer is now read from
    renderersProps.table prop of the HTML component.