react-native-render-html is a powerful, open-source JavaScript component for React Native that translates HTML content into 100% native views across iOS, Android, macOS, and Windows. Unlike WebView-based solutions, it aims for improved performance and a truly native look and feel. The current stable version is v6.3.4, with the v6 "Foundry" release representing a major architectural rewrite focused on enhanced features, performance, and accessibility. The library is actively maintained with regular patch releases and significant minor updates (like v6.2.0 which focused on accessibility improvements). Key differentiators include its highly customizable and "hackable" API, extensive styling options, and robust support for custom renderers and HTML model definitions. It also ships with comprehensive TypeScript types, ensuring type safety for developers.
npm install react-native-render-htmlVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates rendering a complex HTML string using the `RenderHtml` component. It includes basic styling, links, images, lists, and utilizes `useWindowDimensions` for responsive rendering. It also showcases applying custom `tagsStyles`.
Consult the official migration guide from v5 to v6 on the library's website. Pay close attention to changes in custom renderers, styling props (e.g., `baseFontStyle` to `baseStyle`), and image dimension props (`imagesMaxWidth` to `computeEmbeddedMaxWidth`).
For iframe support, install and use the `@native-html/iframe-plugin` package.
Update all CSS property names in your style objects to their camelCase JavaScript equivalents.
Review the documentation on model-based custom rendering and accessibility features in v6.2.0. Ensure interactive elements have appropriate content models and `accessibilityRole` props if custom renderers are used.
Upgrade to version 6.3.4 or higher to resolve the `onLinkPress` issue on Android.
Upgrade to version 6.3.1 or higher to ensure bold styles are correctly applied to `<b>` tags.
Ensure the `source` prop is provided as an object `{ html: 'your_html_string' }` or `{ uri: 'your_html_url' }` and that the content is not empty.Verify that `react` and `react-native` are correctly installed and meet the peer dependency requirements. Ensure `RenderHtml` is imported using `import { RenderHtml } from 'react-native-render-html';`.This issue is often platform-specific or requires workarounds. Consider using `tagsStyles` or `classesStyles` to apply font families that are correctly loaded and recognized by React Native. If the issue persists, refer to the GitHub issues for the latest status or alternative solutions.
Downsize the image at its source or implement custom image handling logic that pre-processes or resizes images before they are rendered by `react-native-render-html`.