diff --git a/apps/website/static/llms-full.txt b/apps/website/static/llms-full.txt new file mode 100644 index 00000000..49d40925 --- /dev/null +++ b/apps/website/static/llms-full.txt @@ -0,0 +1,7410 @@ +# Overview and Getting Started + +## What it is + +`@native-html/render` is an iOS/Android pure-JavaScript React Native component that translates HTML markup into 100% native React Native views (no WebView). It balances HTML/CSS standard compliance with lightweightness and is designed to be highly customizable: you can define custom renderers for specific tags (with control over children rendering), provide styles targeting tags, classes and ids, and tamper with the DOM. The best use cases are rendering predictable content where you know the tags and classes in advance — for example CMS output, API-delivered articles, or sections of a web page. It is not a web engine: it does not execute JavaScript, and it is not the right tool for arbitrary, unpredictable web content. If you need full web semantics, use `react-native-webview` instead (at the cost of performance, since it uses the system Web View). + +The package was previously published as `react-native-render-html`. The v1 release of `@native-html/native` follows exactly the same API, so migrating is plug-and-play. + +## Should I use it? + +Yes, if: + +- You want HTML translated into React Native views (see the Architecture page). +- You want a design that balances HTML/CSS compliance with lightweightness. +- You want extensive customization: custom renderers per tag, styling by tag/class/id, DOM tampering. + +No, if: + +- Your use case is very simple — you may prefer rolling a tiny renderer of your own (see "Reinvent the Wheel" below). +- You need a full web engine with JavaScript execution and full Web standards support — use `react-native-webview` instead. + +Best use cases: + +- Predictable content where you know the tags and classes in advance (CMS, API endpoints). +- Rendering article-like sections of a web page (see Root Selection under DOM tampering for selecting a sub-tree). +- Not recommended for arbitrary, unpredictable content. + +## Install + +```bash +npm install @native-html/render +``` + +```bash +yarn add @native-html/render +``` + +The Foundry release is v6: + +```bash +npm install --save-prod @native-html/render +``` + +## Minimal usage + +```jsx +import React from 'react'; +import { useWindowDimensions } from 'react-native'; +import RenderHtml from '@native-html/render'; + +const source = { + html: ` +
+ Hello World! +
` +}; + +export default function App() { + const { width } = useWindowDimensions(); + return ( ++ Unfortunately, + this hyperlink is not accessible +
+``` + +Luke Walczak from Callstack has a blog post explaining how to work around this issue. The workaround cannot be genericized — a fix in React Native itself is required. + +# Architecture and Data Flow + +Conceptual overview of how `RenderHTML` transforms an HTML string into React Native views: parsing, the Transient Render Engine (TRE), CSS processing, and the composite rendering pipeline. + +## Architecture Overview + +> Important: 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. + +### Hello World + +A minimal working example renders a simple HTML snippet through `RenderHTML`: + +```jsx +import React from 'react'; +import { useWindowDimensions } from 'react-native'; +import RenderHtml from '@native-html/render'; + +const source = { + html: ` ++ Hello World! +
` +}; + +export default function App() { + const { width } = useWindowDimensions(); + return ( +