/* eslint-disable @typescript-eslint/no-unused-vars */
import React from 'react';
import Page from '../Page';
import useToolkit from '../toolkit/useToolkit';
import RefRNRH from '../components/RefRNRH';
import RefHtmlparser2 from '../components/RefHtmlparser2';
import RefTRE from '../components/RefTRE';
export default function PageArchitecture() {
const {
Acronym,
Admonition,
Header,
Paragraph,
Chapter,
SourceDisplay,
RefLibrary,
RefRNSymbol,
RefHtmlElement,
RefCssProperty,
RefDoc,
RenderHtmlCard,
InlineCode,
Hyperlink,
List,
ListItem,
SvgFigure
} = useToolkit();
return (
Consumers of this library can benefit greatly from understanding the
basic data flow model to leverage its capabilities. Features such as
props will touch on different areas of this data flow.
Let's start with a simple example:
Hello World!
`
}
}}
/>
This looks pretty simple. But what exactly is happening under the
hood? As laid out in the page,
we need some logic to translate the DOM into a structure easily
translatable into native elements and support all the features
mentioned in the referred page. This data structure is called the
Transient Render Tree (
), see figure below.
We can roughly split the transformations from an HTML string to a
React tree in 3 steps:
HTML parsing. In this step, the HTML code is parsed to form a DOM
tree. This step is performed by the library.
Construction. In this step, the DOM tree is
transformed in a TRT. Each node of this tree is referred to as a
Transient Node (TNode) which has React-Native compatible styles.
This step is performed by module.
Transient Render Tree Rendering. In this step, the{' '}
is transformed in a React render tree (VDOM).
TNodes are passed to internal and custom renderers.
For more information on construction, see{' '}
and{' '}
pages.
);
}