From deddb6d3c810a89c029671696c92bc0b49bd2d8f Mon Sep 17 00:00:00 2001 From: Galen wei <1947612015@qq.com> Date: Wed, 19 Feb 2025 11:07:19 +0800 Subject: [PATCH] Supplement the hot loading function of the using_SNSurface project Signed-off-by: Galen wei <1947612015@qq.com> --- .../NativeProject/entry/hvigorfile.ts | 4 ++-- .../NativeProject/hvigorfile.ts | 4 ++-- .../src/main/cpp/ButtonView/ButtonNode.cpp | 1 - .../ButtonView/ButtonViewComponentDescriptor.h | 1 - .../src/main/cpp/SampleTurboModulePackage.cpp | 1 - .../entry/src/main/ets/pages/Index.ets | 18 +++++++++++++----- .../SampleProject/MainProject/package.json | 1 + 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/Samples/FabricComponentSample/NativeProject/entry/hvigorfile.ts b/docs/Samples/FabricComponentSample/NativeProject/entry/hvigorfile.ts index d0f029bd..6650e721 100644 --- a/docs/Samples/FabricComponentSample/NativeProject/entry/hvigorfile.ts +++ b/docs/Samples/FabricComponentSample/NativeProject/entry/hvigorfile.ts @@ -8,6 +8,6 @@ import { hapTasks } from '@ohos/hvigor-ohos-plugin'; export default { - system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ - plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins: [] /* Custom plugin to extend the functionality of Hvigor. */ } diff --git a/docs/Samples/FabricComponentSample/NativeProject/hvigorfile.ts b/docs/Samples/FabricComponentSample/NativeProject/hvigorfile.ts index 549b0bad..3ba03076 100644 --- a/docs/Samples/FabricComponentSample/NativeProject/hvigorfile.ts +++ b/docs/Samples/FabricComponentSample/NativeProject/hvigorfile.ts @@ -8,6 +8,6 @@ import { appTasks } from '@ohos/hvigor-ohos-plugin'; export default { - system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ - plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins: [] /* Custom plugin to extend the functionality of Hvigor. */ } diff --git a/docs/Samples/Sample/SampleApp/entry/src/main/cpp/ButtonView/ButtonNode.cpp b/docs/Samples/Sample/SampleApp/entry/src/main/cpp/ButtonView/ButtonNode.cpp index 014334a2..c12cc7f0 100644 --- a/docs/Samples/Sample/SampleApp/entry/src/main/cpp/ButtonView/ButtonNode.cpp +++ b/docs/Samples/Sample/SampleApp/entry/src/main/cpp/ButtonView/ButtonNode.cpp @@ -26,7 +26,6 @@ ButtonNode::~ButtonNode() { } } - ButtonNode& ButtonNode::setButtonNodeDelegate( ButtonNodeDelegate* buttonNodeDelegate) { m_buttonNodeDelegate = buttonNodeDelegate; diff --git a/docs/Samples/Sample/SampleApp/entry/src/main/cpp/ButtonView/ButtonViewComponentDescriptor.h b/docs/Samples/Sample/SampleApp/entry/src/main/cpp/ButtonView/ButtonViewComponentDescriptor.h index f49df242..d4ddc91d 100644 --- a/docs/Samples/Sample/SampleApp/entry/src/main/cpp/ButtonView/ButtonViewComponentDescriptor.h +++ b/docs/Samples/Sample/SampleApp/entry/src/main/cpp/ButtonView/ButtonViewComponentDescriptor.h @@ -5,7 +5,6 @@ * LICENSE-MIT file in the root directory of this source tree. */ - #pragma once #include diff --git a/docs/Samples/Sample/SampleApp/entry/src/main/cpp/SampleTurboModulePackage.cpp b/docs/Samples/Sample/SampleApp/entry/src/main/cpp/SampleTurboModulePackage.cpp index f06464ff..2f2b2abf 100644 --- a/docs/Samples/Sample/SampleApp/entry/src/main/cpp/SampleTurboModulePackage.cpp +++ b/docs/Samples/Sample/SampleApp/entry/src/main/cpp/SampleTurboModulePackage.cpp @@ -43,7 +43,6 @@ class ButtonViewPackageComponentInstanceFactoryDelegate : public ComponentInstan } }; - EventEmitRequestHandlers SampleTurboModulePackage::createEventEmitRequestHandlers() { return {std::make_shared()}; } diff --git a/docs/Samples/using_RNSurface/SampleApp/entry/src/main/ets/pages/Index.ets b/docs/Samples/using_RNSurface/SampleApp/entry/src/main/ets/pages/Index.ets index 721b3cff..404a6ee6 100644 --- a/docs/Samples/using_RNSurface/SampleApp/entry/src/main/ets/pages/Index.ets +++ b/docs/Samples/using_RNSurface/SampleApp/entry/src/main/ets/pages/Index.ets @@ -53,11 +53,19 @@ export struct Index { enableCAPIArchitecture: true, arkTsComponentNames: [] }); - await this.instance.runJSBundle(new ResourceJSBundleProvider(getContext().resourceManager, this.bundlePath)) - .then(() => { - this.isBundleReady = true; - console.log('instance 加载完成' + this.bundlePath); - }) + await this.instance.runJSBundle(new TraceJSBundleProviderDecorator( + new AnyJSBundleProvider([ + new ResourceJSBundleProvider(getContext().resourceManager, this.bundlePath), + new MetroJSBundleProvider(), + new FileJSBundleProvider('/data/storage/el2/base/files/bundle.harmony.js'), + new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'), + new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'bundle.harmony.js') + ]),this.rnohCoreContext.logger)) + .then(() => { + this.isBundleReady = true; + console.log('instance 加载完成' + this.bundlePath); + }) + } build() { diff --git a/docs/Samples/using_RNSurface/SampleProject/MainProject/package.json b/docs/Samples/using_RNSurface/SampleProject/MainProject/package.json index 80ef7cdf..cc7011c7 100644 --- a/docs/Samples/using_RNSurface/SampleProject/MainProject/package.json +++ b/docs/Samples/using_RNSurface/SampleProject/MainProject/package.json @@ -7,6 +7,7 @@ "ios": "react-native run-ios", "lint": "eslint .", "test": "jest", + "start":"react-native start --config metro.config.js", "dev": "react-native bundle-harmony --dev false --entry-file ./src/bundles/index.js --bundle-output ../../SampleApp/entry/src/main/resources/rawfile/bundle.harmony.js --config ./bundle.config.js --assets-dest ../../SampleApp/entry/src/main/resources/rawfile" }, "dependencies": { -- Gitee