- Follow the instructions in the Prerequisites section
- Copy
tester/.npmrcto your project - Create access token and set
RNOH_NPM_TOKENby following instructions above - Install react-native-harmony:
npm i react-native-harmony@npm:@rnoh/react-native-harmony - Copy
metro.config.jsto your project - Create a new Harmony project in
<YOUR_PROJECT>/harmony - Copy
tester/harmony/entrymodule to<YOUR_PROJECT>/harmony/entry - Run
./node_modules/.bin/react-native unpack-harmony- it may take a while - Add
"postinstall": "react-native unpack-harmony"topackage.json's script section - Update
tester/harmony/entry/src/main/ets/pages/Index.ets- Unregister
SampleViewandSamplePackage - Update "app_name" to match the name specified in
<YOUR_PROJECT>/app.json::name
- Unregister
- Update
tester/harmony/entry/src/main/cpp/CMakeLists.txt- Update
RNOH_CPP_DIR-set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules/react-native-harmony/harmony/cpp") - Unregister
SamplePackage
- Update
- Open
harmonyproject in DevEcoStudio and run the project
Note: native code lives in the /tester/harmony/rnoh directory (native code must be in the project directory).
This project uses unreleased DevEco Studio 4.0.3.700 and Open Harmony SDK shipped with DevEco. Follow steps below to install the IDE and required SDKs.
Before starting the development you have to install required SDKs.
- Download SDK from internal channel or download unreleased DevEcoStudio (unreleased SDK should be included)
- Change path to SDK in Dev Eco Studio:
Tools->SDK Manager - Update your
buildProfile.json5based onbuildProfile.template.json5 - Update
hvigor- Copy contents of
pluginsfrom internal DevEcoStudio release directory totester/harmony/hvigor - Open
tester/harmony/hvigor/hvigor-config.json5in DevEcoStudio - DevEcoStudio should show yellow pop ups which should allow you to install dependencies and sync the project
- Copy contents of
- DevEcoStudio:
Build->Clean Project - Remove
.cxxdirectory fromentrymodule - Build and run the tester app
- On Mac, gatekeeper may complain about running unsigned apps. In such case disable gatekeeper completely or
- Press the Cancel button
- Open Mac Settings and search for Gatekeeper
- Click the button that allows running the cancelled application
- Try building the app again, this time you should be able to click
Openbutton instead ofMove to bin - Repeat this process until Gatekeeper stops complaining (~20 apps/libs)
Before you begin, you have to install the git client on your computer. Refer to the git documentation for more details about installation.
In order to download project dependencies from the git repository, you will have to create the access token and save it in environment variables:
- Press the
Edit profilebutton on GitLab (press on your avatar on the navbar and then on the button) - Select
Access Tokenstab in the menu on the left side - Fill the
Token namefield (e.g. it can bernoh) and select theapiscope in theSelect scopesform - Press the
Create personal access tokenbutton to create the token - Copy the token
- Press
Win + Rto open the Windows Run prompt - Type in
sysdm.cpland clickOk - Go to the
Advancedtab - Press on the
Environment Variablesbutton - Add the new user variable by pressing the
Newbutton under the User variables section - Set variable name to
RNOH_NPM_TOKENand paste your access token in the variable value field
More details about GitLab access tokens can be found in the docs
- On the project repository page press the clone button and copy the url to clone the project
- In your terminal go to the directory where you want to store project files
- Run the
git clone --recurse-submodules <url>command to clone the repository with all submodules (replace the<url>with the copied url from the repository page on GitLab)
- Go to the
react-native-harmonydirectory - Create the package by running the
npm packcommand - Go to the
../testerdirectory - Run the
npm icommand to install dependencies and setup build-profile - Open the
/tester/harmony/entry/oh_package.json5in the DevEco Studio - Click "Sync" on the pop-up at the top
Before you start the project, you have to setup the device on which you will be able to run the application. Up to 3.1.0 version of the DevEco Studio IDE, you can create the Local Emulator to test the app on your computer.
- Open the
Device Manager(press the dropdown near the run button (green triangle) on the top ribbon) - Press on the
Device Mangeroption on the list - Press the
Installbutton to install the emulator SDK - Click on the
Finishbutton after installation - Press the
New emulatorbutton in the bottom right corner - Go through the emulator setup. You can customize the emulator settings
- You will see the success message popup if the emulator is successfully created
- Open the
Device Managerand start the emulator - Press the
Run entrybutton in the top ribbon to build the project and run on the emulator - Wait for the build to finish
- Go to the
/tester - Run
npm i - Run
npm run dev - Open
/tester/harmonyin DevEco Studio - Start the HarmonyOS emulator
- Run
hdc rport tcp:8081 tcp:8081Ifhdcis not in yourPATH, it can be found under<OPEN_HARMONY_SDK>/X86SDK/openharmony/10/toolchains - Start metro by running
npm run start - Build and run entry module
Frame times can be measured using node ./scripts/get-frame-times. It runs hdc hitrace and returns an array (frame times) which contains the time gap between repaints. You can also use it to get the frame times from manually captured traces.
You can use node ./scripts/create-fps-stats to get a performance report based on the measured frame times. node ./scripts/create-fps-stats-flipper file1.csv file2.csv generates the performance report based on one or more .csv files exported from flippers rnperfmonitor plugin, allowing to compare performance to react-native-android.
- Go to the
/react-native-harmony - Run
npm run pack:prod
