Skip to main content

Installation

This section walks you through adding react-native-enriched-markdown to your app - checking the prerequisites, installing the package, and rebuilding the native projects.

Prerequisites​

The library requires the React Native New Architecture (Fabric), which every supported React Native version enables by default.

It also needs these minimum platform versions:

  • React Native - 0.83 or newer.
  • Android - minSdk 24 (Android 7.0).
  • iOS - React Native's own minimum deployment target; a few features additionally require iOS 16+ (for example contextMenuItems).
  • macOS (via react-native-macos) - 14.0. See macOS support for what differs there.

The package declares no runtime dependencies. Its one optional peer dependency is katex, used only by the web build to typeset LaTeX; npm's warning about a missing optional peer is safe to ignore unless you render math on web.

For the exact React Native versions we support, see Compatibility.

Install the package​

Install the package with your package manager of choice:

npm install react-native-enriched-markdown

The library contains native code, so rebuild your app after installing. On iOS, install the pods first:

cd ios && bundle exec pod install

(Drop bundle exec if your project does not pin CocoaPods through a Gemfile.)

Install-time native downloads​

Installing the package runs a postinstall script that downloads the native assets the optional features need: the tree-sitter grammars used for code-block highlighting (from registry.npmjs.org) and the RaTeX framework used for LaTeX math on iOS (from github.com). Together they are around 200 MB and are fetched once, then cached.

The script warns but never fails, so a restricted network, an --ignore-scripts install, or a package manager that skips lifecycle scripts leaves you with a quietly feature-less build. To re-run it:

npm rebuild react-native-enriched-markdown
# or, directly:
node node_modules/react-native-enriched-markdown/postinstall.mjs

Run it before pod install or the Android build, and see Native assets for how to opt out of either download deliberately.

note

pnpm blocks dependency lifecycle scripts by default, so the postinstall above never runs. Allow it by adding the package to onlyBuiltDependencies (in pnpm-workspace.yaml, or the "pnpm" field of your package.json), or run the recovery command above afterwards. Yarn PnP is not supported.

Expo​

Install with the Expo CLI so the correct version is picked for your SDK:

npx expo install react-native-enriched-markdown

Then regenerate the native projects and run the app:

npx expo prebuild
npx expo run:ios # or run:android
note

The library needs native code, so it won't run in Expo Go. Use a development build instead.

There is no Expo config plugin. The former one was removed in 1.0.2 (see Breaking changes); feature configuration now lives in an enriched-markdown block in your app's package.json, which the podspec and Gradle script read directly. See Native assets for the keys.

Nightly builds​

To try features before they land in a stable release, install the nightly build:

npm install react-native-enriched-markdown@nightly
caution

Nightlies are published to npm automatically and may contain breaking changes.


You're set up. Next, build your first view and editor.