Skip to main content


Composite Rendering Architecture#

When you consume the โ€‹RenderHTML component, you are actually using three distinct components. So this (implicit composite):

<RenderHTML source={{ html }} />

is equivalent to this (explicit composite):

<RenderHTMLSource source={{ html }} />

You can actually use the explicit composite architecture by importing those components:

import {
} from 'react-native-render-html';

The great benefit of using explicitly this composite rendering architecture is that the engine and configuration can be put near the top of your App to factor the cost of instantiating the engine. This is especially usefull for apps which will render hundreds to thousands of small snippets such as chat apps.

Note that props of the โ€‹RenderHTML component are split between the three layers of the rendering architecture:


Will take all โ€‹RenderHTML props pertaining to the โ€‹Transient Render Engine layer such as โ€‹customHTMLElementModels, โ€‹classesStyles (all styling props) and DOM related such as โ€‹domVisitors, โ€‹selectDomRoot... See โ€‹TRenderEngineConfig for a complete reference.


Will take all โ€‹RenderHTML props pertaining to the โ€‹Rendering layer such as โ€‹renderers, โ€‹renderersProps, โ€‹computeEmbeddedMaxWidth, ... See โ€‹RenderHTMLConfig for a complete reference.


Will take all โ€‹RenderHTML props pertaining to the document such as โ€‹source, โ€‹onTTreeChange, โ€‹contentWidth. See โ€‹RenderHTMLSourceProps for a complete reference.

Default TNode Renderers#

Each node of the โ€‹TRT is translated to a React component in the TNodeRenderer component. Internally, TNodeRenderer will map each type of TNode to its dedicated component. TDocumentRenderer for TDocument nodes, TBlockRenderer for โ€‹TBlock nodes, TPhrasingRenderer for โ€‹TPhrasing nodes and TTextRenderer for โ€‹TText nodes.

Under the hood, TPhrasingRenderer and TTextRenderer use React Native โ€‹Text wrapper component, while TBlockRenderer and TDocumentRenderer use React Native โ€‹View wrapper component.

Each renderer will pass styles provided by its underlying TNode to its React Native wrapper. Children are rendered thanks to the TChildrenRenderer component.

Custom Renderers#

Custom renderers are components defined for specific tags. They can be specified with the โ€‹renderers prop, which is a mapping of tags with the corresponding components. See the โ€‹Custom Rendering page. Also note that props targeting those renderers can be passed to a custom renderer via the โ€‹renderersProps prop, which is a mapping of tag names with its corresponding props. Those props can be consumed from the custom renderer via useRendererProps hook.

Internal Renderers#

Some tags such as โ€‹<img>, โ€‹<ol>, โ€‹<ul> and โ€‹<a> are handled by special renderers, namely internal renderers. Those renderers can be thought of as "internal custom renderers". See the โ€‹Images, โ€‹Lists and โ€‹Anchors corresponding pages.