How do I create a React Native app for HarmonyOS?
Short answer: Use RNOH (React Native for OpenHarmony) from the CPF-RN organization on GitCode. Install the @react-native-oh/react-native-harmony package for the React Native version you target, set up the SDK versions in the HarmonyOS project, bundle the JavaScript with Metro, and build a HAP with hvigor in DevEco Studio.
What is RNOH?
RNOH is a community framework that lets React Native apps run on HarmonyOS. It integrates with ArkUI and supports the Fabric architecture. The main repository is CPF-RN/ohos_react_native. The organization is MIT-licensed and developed under the OpenAtom Foundation. Your JavaScript or TypeScript code stays React Native code; the native side is a HarmonyOS project.
Which versions are supported?
| React Native line | Status (from the organization page) |
|---|---|
| 0.84.x | Current stable. 0.84.3 makes Hermes V1 the default JS engine and requires Node.js 22+ |
| 0.77.x | LTS, enhanced new architecture |
| 0.72.x | LTS, long-term maintenance |
The repository README describes version lines and npm dist-tags such as 0.72-stable. Check the repository for the exact current list before you start, because it changes between releases.
What do you need first?
- DevEco Studio and the SDK. See How to install DevEco Studio.
- Node.js, at the version in the repository’s
.node-versionfile. - A device or emulator visible with
hdc. See the hdc command guide.
How do I set up the project?
-
Install the package for your React Native line:
npm install @react-native-oh/react-native-harmony@0.72-stableUse the dist-tag or version that matches your React Native version. A tag such as
0.72-stablefollows the latest stable release of that line. -
Configure SDK versions in the HarmonyOS project, as the RNOH docs recommend:
{ "compatibleSdkVersion": "5.0.0(12)", "targetSdkVersion": "26.0.0" }compileSdkVersionmust be greater than or equal totargetSdkVersion, otherwise compilation fails. Follow the “SDK version configuration guide” in the repository docs for the current values. -
Bundle the JavaScript with Metro, which uses the standard React Native Metro configuration.
-
Build and sign the HAP with hvigor. The repository has a build and symbol management guide for this step. For signing basics, see Your first ArkTS app.
I could not read the exact project-creation and bundle commands from the public docs pages, so follow the repository’s development guide for those steps instead of guessing them.
How do I add third-party libraries?
The usage-docs repository catalogs 200+ ported libraries (UI components, navigation, media, storage, sensors). Three points from it:
- Most libraries support Codegen. You must run it to generate the bridging code before using them.
- Future development is based on the C-API architecture only.
- If you use the
react_native_openharmony-xxx-release.harpackage, you need extratarget_compile_optionssettings.
Library packages use the @react-native-oh namespace, for example @react-native-oh/react-native-skia. The usage docs also mention an @react-native-ohos prefix, so check each library’s README for its exact package name.
Next steps
Frequently asked questions
What is RNOH?
RNOH is React Native for OpenHarmony, a community framework in the CPF-RN organization on GitCode that runs React Native apps on HarmonyOS through ArkUI integration, with full Fabric (new architecture) support.
Which React Native versions does RNOH support?
The organization page lists 0.84.x as the current stable line, 0.77.x as LTS with enhanced new architecture, and 0.72.x as LTS under long-term maintenance. The repository README mentions the same multi-version approach. Check the repository for the current list.
How do I install the RNOH package?
Install @react-native-oh/react-native-harmony with a version or dist-tag, for example @react-native-oh/react-native-harmony@0.72-stable, which follows the latest stable release of that line.
Which Node.js version is required?
The repository pins the version in its .node-version file. The 0.84.3 release notes on the organization page say Node.js 22 or later is required.
How do I use third-party React Native libraries?
Use the ported libraries listed in the CPF-RN usage-docs repository (200+ libraries). Most support Codegen, and you must run it to generate the bridging code before use.