- Follow the instructions in the Prerequisites section
- Copy
tester/.npmrc
to your project - Create access token and set
RNOH_NPM_TOKEN
by following instructions above - Install react-native-harmony:
npm i react-native-harmony@npm:@rnoh/react-native-harmony
- Copy
metro.config.js
to your project - Create a new Harmony project in
<YOUR_PROJECT>/harmony
- Copy
tester/harmony/entry
module 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
SampleView
andSamplePackage
- 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
harmony
project 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.json5
based onbuildProfile.template.json5
- Update
hvigor
- Copy contents of
plugins
from internal DevEcoStudio release directory totester/harmony/hvigor
- Open
tester/harmony/hvigor/hvigor-config.json5
in 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
.cxx
directory fromentry
module - 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
Open
button 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 profile
button on GitLab (press on your avatar on the navbar and then on the button) - Select
Access Tokens
tab in the menu on the left side - Fill the
Token name
field (e.g. it can bernoh
) and select theapi
scope in theSelect scopes
form - Press the
Create personal access token
button to create the token - Copy the token
- Press
Win + R
to open the Windows Run prompt - Type in
sysdm.cpl
and clickOk
- Go to the
Advanced
tab - Press on the
Environment Variables
button - Add the new user variable by pressing the
New
button under the User variables section - Set variable name to
RNOH_NPM_TOKEN
and 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-harmony
directory - Create the package by running the
npm pack
command - Go to the
../tester
directory - Run the
npm i
command to install dependencies and setup build-profile - Open the
/tester/harmony/entry/oh_package.json5
in 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 Manger
option on the list - Press the
Install
button to install the emulator SDK - Click on the
Finish
button after installation - Press the
New emulator
button 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 Manager
and start the emulator - Press the
Run entry
button 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/harmony
in DevEco Studio - Start the HarmonyOS emulator
- Run
hdc rport tcp:8081 tcp:8081
Ifhdc
is 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