/* eslint-disable @typescript-eslint/no-unused-vars */ import React from 'react'; import Page from '../Page'; import useToolkit from '../toolkit/useToolkit'; export default function PageIntroduction() { const { Acronym, Bold, Admonition, Conditional, Header, Paragraph, Chapter, SourceDisplay, RefLibrary, RefRNSymbol, RefHtmlElement, RefCssProperty, RefDoc, RefRenderHtmlProp, RenderHtmlCard, Section, InlineCode, Hyperlink, List, ListItem, SvgFigure } = useToolkit(); return (
HTML markup is translated into React Native views. See the{' '} page for more details. Its design balances compliance to HTML and CSS standards with lightweightness, despite some limitations and caveats. It aims at being extremely customizable. For example, you can{' '} define custom renderers{' '} targetting specific tags with a mean to define children rendering, provide{' '} styles for tags, classes and ids , and tamper with the DOM.
If your use-case is pretty straightforward, you might implement{' '} your own, lightweight HTML renderer. This is not a Web engine! If you need to load JavaScript along, or you need all features of the Web standards, you should use{' '} {' '} instead. Beware that it will certainly have a bigger impact on your App's performances, since it will use the system's Web View.
The best use case for library is when the content to render is predictable (e.g. you know in advance the tags and classes to support), such as rendering content from a CMS, or via API endpoints. You might also benefit from this library if you need to render sections of a web page such as articles which content is reasonably predictable, (see{' '} Root Selection {' '} to select an element of the DOM to render). You should probably not use this library if you need to render arbitrary, unpredictable content.
Install react-native-render-html Foundry release (v6) on your project: Let's start with a simple example: Hello World!

` } }} /> Press the Run on Your Device with Expo button to try it out on your device, and change the HTML from the Expo editor. Inspect the pre-render tree representation with the{' '} TRT Snapshot tab. The prop specifies the HTML content to load. This prop also supports an{' '} uri field for remote loading and a{' '} dom field for asynchronous DOM pre-processing (see{' '} Prerendering ). The prop allows proper image scaling. See page for more details.
); }