CollectUICollectUI

HeroUI Native

Initialize a HeroUI Native project

This article is manually written (md) and AI-optimized (mdx).

Clone heroui-native-example to your local machine, then install dependencies and start.

Clone the Project

git clone https://github.com/heroui-inc/heroui-native-example

Make sure p cli is installed:

bun install -g ru-yaka/p

Then clone the project. It will be automatically placed under ~/.p/projects/ and opened with your IDE (default is cursor, configurable via p config):

p clone heroui-inc/heroui-native-example
p clone

Install Dependencies

npm install
pnpm install
bun install
yarn install

Allow Build Scripts

After installation, run start. pnpm may block the build script for unrs-resolver:

unrs-resolver error

Run pnpm approve-builds and interactively approve it (press space to select, then Enter). Alternatively, you can directly edit pnpm-workspace.yaml and set it to true.

unrs-resolver is a high-performance module resolver written in Rust. It requires a postinstall script to compile the binary for the corresponding platform.

Start the Project

npm run start
pnpm run start
bun run start
yarn start

Start the project

You'll notice two dependencies are incompatible with the current expo version (55 at the time of testing).

Fix Dependencies

Stop start, then automatically install the compatible versions for the current expo:

npx -y expo install react-native react-native-worklets
pnpm dlx expo install react-native react-native-worklets
bunx expo install react-native react-native-worklets
yarn dlx expo install react-native react-native-worklets

Fix dependencies

Verify It Runs

Restart, then scan the QR code with Expo Go 55 to test.

The Expo Go version must match the current expo SDK version, otherwise it won't run.

Everything works as expected:

Runs successfully

Add as a Template

Add the current project as a template so you can quickly create new projects from it locally (with dependencies already fixed):

p tp add . heroui-native
p template add . heroui-native
p templates add . heroui-native

p tp add

Create a New Project from the Template

p new my-heroui-native-app -t heroui-native
p n my-heroui-native-app -t heroui-native
p create my-heroui-native-app -t heroui-native

p new

p new <name> quickly creates a project (managed under ~/.p/projects/) and opens it with your configured IDE (default is cursor, configurable via p config). If you forget the template name, leave -t empty for an interactive selection, or use -t <fuzzy_name> for fuzzy search.

How is this guide?

Last updated on

On this page