Skip to content

React Native

The React Native plugin gives every Expo app a start and an export task, and every other React Native app a start task.

Terminal window
axle add react-native

This writes it into the root axle.toml:

[plugins.react-native]
source = "npm:@axle-rs/[email protected]"
hash = "sha256-…"

A package is an Expo app when it depends on expo, and a React Native app when it depends on react-native without expo. It gets:

Task Command Settings
start expo start Expo apps: persistent, with the EXPO_ variables passed through
export expo export Expo apps: outputs dist
start react-native start React Native apps: persistent

Each command runs through the repository’s package manager, such as pnpm exec expo start, so it uses the version the package installs.

Axle already hashes the EXPO_PUBLIC_ variables an Expo app reads, since they are written into the exported bundle. Native builds for iOS and Android stay in the app’s own scripts.

A package’s own script wins. When its package.json has a script with a task’s name that runs something else, such as "start": "expo start --dev-client", the plugin leaves that task alone and Axle runs the script. A script that only runs the same command is replaced by the plugin’s task, which runs the same command and adds its settings. The repository’s axle.toml changes a task as it would any other, and wins over the plugin.

Setting Default Meaning
start "start" the name of the Metro task, or false to leave it out
export "export" the name of the Expo export task, or false
[plugins.react-native]
source = "npm:@axle-rs/[email protected]"
hash = "sha256-…"
export = "bundle"

The plugin’s answers are kept until an app.json or app.config.*, a package.json, pnpm-workspace.yaml or a lockfile changes.