/* eslint-disable @typescript-eslint/no-unused-vars */
import React from 'react';
import Page from '../Page';
import useToolkit from '../toolkit/useToolkit';
const compositeSrc = `
`;
const compositeImportStmt = `import {
TRenderEngineProvider,
RenderHTMLConfigProvider,
RenderHTMLSource
} from 'react-native-render-html';`;
export default function PageConceptRendering() {
const {
Acronym,
Admonition,
Bold,
DList,
DListItem,
DListTitle,
Header,
Paragraph,
Chapter,
SourceDisplay,
RefLibrary,
RefRNSymbol,
RefHtmlElement,
RefCssProperty,
RefRenderHtmlProp,
RefRenderHTMLExport,
RefTRE,
RefHtmlAttr,
RefDoc,
RenderHtmlCard,
Section,
InlineCode,
Hyperlink,
List,
ListItem,
SvgFigure
} = useToolkit();
return (
When you consume the {' '}
component, you are actually using three distinct components. So this (
implicit composite):
is equivalent to this (explicit composite):
You can actually use the explicit composite architecture
by importing those components:
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 useful for apps which will
render hundreds to thousands of small snippets such as chat apps.
Note that props of the {' '}
component are split between the three layers of the rendering
architecture:
Will take all props
pertaining to the layer
such as ,{' '}
(all styling props) and
DOM related such as ,{' '}
... See for a
complete reference.
Will take all props
pertaining to the layer such as{' '}
,{' '}
,{' '}
, ... See{' '}
for a complete
reference.
Will take all props
pertaining to the document such as{' '}
, ,{' '}
. See{' '}
for a complete
reference.
Each node of the 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 {' '}
nodes, TPhrasingRenderer for{' '}
nodes and{' '}
TTextRenderer for {' '}
nodes.
Under the hood, TPhrasingRenderer and{' '}
TTextRenderer use React Native{' '}
wrapper component, while{' '}
TBlockRenderer and{' '}
TDocumentRenderer use React Native{' '}
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 are components defined for specific tags. They can be
specified with the prop, which
is a mapping of tags with the corresponding components. See the{' '}
page. Also note that props
targeting those renderers can be passed to a custom renderer via the{' '}
prop, which is a mapping
of tag names with its corresponding props. Those props can be consumed
from the custom renderer via useRendererProps{' '}
hook.
Some tags such as ,{' '}
, and{' '}
are handled by special renderers, namely{' '}
internal renderers. Those renderers can be thought of as
"internal custom renderers". See the ,{' '}
and {' '}
corresponding pages.
);
}