From abf6f1856970dee8044f74011db042f7cec36f77 Mon Sep 17 00:00:00 2001 From: x30015140 Date: Wed, 22 Jan 2025 19:30:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E6=A1=A3?= =?UTF-8?q?=EF=BC=9AHermes=20=E5=BC=95=E6=93=8E=E5=88=87=E6=8D=A2=E6=88=90?= =?UTF-8?q?=20JSVM=20=E5=BC=95=E6=93=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: x30015140 --- ...00\345\217\221\345\234\272\346\231\257.md" | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git "a/docs/zh-cn/\345\270\270\350\247\201\345\274\200\345\217\221\345\234\272\346\231\257.md" "b/docs/zh-cn/\345\270\270\350\247\201\345\274\200\345\217\221\345\234\272\346\231\257.md" index 8008976b..387acf87 100644 --- "a/docs/zh-cn/\345\270\270\350\247\201\345\274\200\345\217\221\345\234\272\346\231\257.md" +++ "b/docs/zh-cn/\345\270\270\350\247\201\345\274\200\345\217\221\345\234\272\346\231\257.md" @@ -624,6 +624,42 @@ this.rnInstance.getTurboModule(LogBoxTurboModule.NAME).eventE ![faq-bundlle-hbc](./faqs/figures/faq-bundlle-hbc.png) +> [注意] hbc 只使用于Hermes JS 引擎,JSVM 引擎无法加载hbc。 + +### 由Hermes 引擎切换成 JSVM 引擎 + +目前RNOH默认使用的是Hermes引擎,无需用户额外配置。如果想切换成JSVM 引擎,可遵循以下步骤操作: + +[场景一] 使用RNOH源码har包 + +到应用模块的CMakeLists.txt文件中添加 `set(USE_HERMES 0)`: + +```diff + set(LOG_VERBOSITY_LEVEL 1) ++ set(USE_HERMES 0) +``` + +[场景二] 使用RNOH release版本的har包 + +跟源码类似,不过要改两个地方,具体如下: + +```diff + set(LOG_VERBOSITY_LEVEL 1) ++ set(USE_HERMES 0) + # ... + if("$ENV{RNOH_C_API_ARCH}" STREQUAL "1") + message("Experimental C-API architecture enabled") + target_link_libraries(rnoh PUBLIC libqos.so) + target_compile_definitions(rnoh PUBLIC C_API_ARCH) + endif() + ++ if(USE_HERMES) ++ target_compile_definitions(rnoh PUBLIC USE_HERMES=1) ++ else() ++ target_compile_definitions(rnoh PUBLIC USE_HERMES=0) ++ endif() +``` + ### 如何减少hap包的体积 较大的 HAP 包可能导致应用程序在下载、安装和运行时占用更多资源,影响用户体验。因此,在构建或编译 OpenHarmony 应用程序时,可以通过调整或更改编译设置,以减少最终生成的 HAP 包的文件大小。 -- Gitee From 432e5525f63073cc37201627781c2114d850138b Mon Sep 17 00:00:00 2001 From: xujerwu Date: Thu, 23 Jan 2025 20:57:49 +0800 Subject: [PATCH 2/3] fix:crash when updateConstraints called on a destroyed surface Signed-off-by: xujerwu --- .../src/main/ets/RNOH/RNInstancesCoordinator.ets | 5 ++++- .../react_native_openharmony/src/main/ets/RNSurface.ets | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNInstancesCoordinator.ets b/tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNInstancesCoordinator.ets index b63dc4ea..460b7e4a 100644 --- a/tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNInstancesCoordinator.ets +++ b/tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNInstancesCoordinator.ets @@ -282,6 +282,9 @@ export class RNInstancesCoordinator { public onDestroy() { const stopTracing = this.logger.clone("onDestroy").startTracing() + if (this.timerId) { + clearTimeout(this.timerId) + } this.jsPackagerClient.onDestroy() this.rnInstanceRegistry.forEach(instance => { instance.onDestroy() @@ -334,7 +337,7 @@ export class RNInstancesCoordinator { }) this.lastChangeTime = currentTime; } else { - if(this.timerId){ + if (this.timerId) { clearTimeout(this.timerId) } this.timerId = setTimeout(() =>{ diff --git a/tester/harmony/react_native_openharmony/src/main/ets/RNSurface.ets b/tester/harmony/react_native_openharmony/src/main/ets/RNSurface.ets index 48e15092..8fa36bdf 100644 --- a/tester/harmony/react_native_openharmony/src/main/ets/RNSurface.ets +++ b/tester/harmony/react_native_openharmony/src/main/ets/RNSurface.ets @@ -158,6 +158,9 @@ export struct RNSurface { aboutToDisappear() { const surfaceHandle = this.surfaceHandle; + if (this.timerId) { + clearTimeout(this.timerId); + } (async () => { const stopTracing = this.logger.clone("aboutToDisappear").startTracing() this.cleanUpCallbacks.forEach(cb => cb()) @@ -202,6 +205,9 @@ export struct RNSurface { override onMeasureSize(selfLayoutInfo: GeometryInfo, children: Array, constraint: ConstraintSizeOptions): SizeResult { + if (this.surfaceHandle.isDestroyed()) { + return {width: 0, height: 0}; + } const currentTime = Date.now(); if (currentTime - this.lastChangeTime > this.delayTime) { this.currentMeasuredSize = @@ -213,7 +219,7 @@ export struct RNSurface { }) this.lastChangeTime = currentTime; } else { - if(this.timerId){ + if (this.timerId) { clearTimeout(this.timerId) } this.timerId = setTimeout(() =>{ -- Gitee From b08f03f8ba52c4ea6ba0682965fe84648486e5eb Mon Sep 17 00:00:00 2001 From: linhandev Date: Thu, 23 Jan 2025 07:20:19 +0000 Subject: [PATCH 3/3] feat(build): building tester defaults to use bisheng toolchain Signed-off-by: linhandev --- tester/harmony/build-profile.template.json5 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tester/harmony/build-profile.template.json5 b/tester/harmony/build-profile.template.json5 index 6120e428..27046386 100644 --- a/tester/harmony/build-profile.template.json5 +++ b/tester/harmony/build-profile.template.json5 @@ -6,6 +6,9 @@ signingConfig: 'default', compatibleSdkVersion: '5.0.0(12)', runtimeOS: 'HarmonyOS', + "buildOption": { + "nativeCompiler": "BiSheng" + } }, ], buildModeSet: [ -- Gitee