import React from 'react'; import RenderHTML from '@native-html/render'; import { useHtmlTableProps, tableModel } from '@native-html/table-plugin'; import ClickTable from './ClickTable'; import WebView from 'react-native-webview'; const table1 = ` This custom component will adapt it's layout depending on table stats. If the table has less than 4 columns and 8 rows, or less than 400 printable characters, it will be shown inline. Otherwise, a button will be displayed to open a modal.

Small table

Entry Header 1 Entry Header 2 Entry Header 3
Entry First Line 1 Entry First Line 2 Entry First Line 3
Entry Second Line 1 Entry Second Line 2 Entry Second Line 3
Entry Third Line 1 Entry Third Line 2 Entry Third Line 3

Big table

Company Contact Country
Alfreds Futterkiste website Maria Anders Germany
Centro comercial Moctezuma Francisco Chang Mexico
Ernst Handel Roland Mendel Austria
Island Trading Helen Bennett UK
Laughing Bacchus Winecellars Yoshi Tannamuri Canada
Magazzini Alimentari Riuniti Giovanni Rovelli Italy
Alfreds Futterkiste website Maria Anders Germany
Centro comercial Moctezuma Francisco Chang Mexico
Ernst Handel Roland Mendel Austria
Island Trading Helen Bennett UK
Laughing Bacchus Winecellars Yoshi Tannamuri Canada
Magazzini Alimentari Riuniti Giovanni Rovelli Italy
Alfreds Futterkiste website Maria Anders Germany
Centro comercial Moctezuma Francisco Chang Mexico
Ernst Handel Roland Mendel Austria
Island Trading Helen Bennett UK
Laughing Bacchus Winecellars Yoshi Tannamuri Canada
Magazzini Alimentari Riuniti Giovanni Rovelli Italy
Island Trading Helen Bennett UK
Laughing Bacchus Winecellars Yoshi Tannamuri Canada
Magazzini Alimentari Riuniti Giovanni Rovelli Italy

Text

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

`; function TableRenderer(props) { const tableProps = useHtmlTableProps(props); return React.createElement(ClickTable, tableProps); } TableRenderer.model = tableModel; const htmlConfig = { renderers: { table: TableRenderer }, tagsStyles: { table: {} }, WebView, defaultWebViewProps: {} }; export default function CustomExample({ instance, onLinkPress, availableWidth }) { return ( null} source={{ html: table1 }} contentWidth={availableWidth} renderersProps={{ a: { onPress: onLinkPress }, ...htmlConfig.renderersProps }} debug={false} /> ); }