diff --git a/OAT.xml b/OAT.xml
index aeef29d65e3a3596937096bb53dcee25bfc99763..94cfc228f73384c6994bfe78a2e532c8d7f34ab6 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -16,6 +16,7 @@
+
@@ -36,6 +37,7 @@
+
@@ -60,6 +62,7 @@
+
diff --git a/example/.eslintrc b/example/.eslintrc
new file mode 100644
index 0000000000000000000000000000000000000000..76cd1cdca17f5f45ea5a75fd4b493c47655cbe67
--- /dev/null
+++ b/example/.eslintrc
@@ -0,0 +1,13 @@
+{
+ "extends": "@react-native",
+ "rules": {
+ "react-native/no-inline-styles": "off",
+ "react/no-unstable-nested-components": "off",
+ "react/react-in-jsx-scope": "off",
+ "@typescript-eslint/no-unused-vars": "warn",
+ "react-hooks/exhaustive-deps": "off",
+ "radix": "off",
+ "prettier/prettier": "warn",
+ "max-lines": "off"
+ }
+}
\ No newline at end of file
diff --git a/example/.gitignore b/example/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..7613cdedd309866629ce9ae75eb3855ea0849f0a
--- /dev/null
+++ b/example/.gitignore
@@ -0,0 +1,71 @@
+.husky
+bundle.harmony.js
+package-lock.json
+*.hbc
+lintCppResult.txt
+
+# ---
+
+# OSX
+#
+.DS_Store
+
+# Xcode
+#
+build/
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata
+*.xccheckout
+*.moved-aside
+DerivedData
+*.hmap
+*.ipa
+*.xcuserstate
+
+# Android/IntelliJ
+#
+build/
+.idea
+.gradle
+local.properties
+*.iml
+*.hprof
+.cxx/
+*.keystore
+!debug.keystore
+BuildProfile.ets
+
+# node.js
+#
+node_modules/
+npm-debug.log
+yarn-error.log
+
+# fastlane
+#
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
+# screenshots whenever they are needed.
+# For more information about the recommended setup visit:
+# https://docs.fastlane.tools/best-practices/source-control/
+
+**/fastlane/report.xml
+**/fastlane/Preview.html
+**/fastlane/screenshots
+**/fastlane/test_output
+
+# Bundle artifact
+*.jsbundle
+
+# Ruby / CocoaPods
+/vendor/bundle/
+
+# Temporary files created by Metro to check the health of the file watcher
+.metro-health-check*
+*.htrace
\ No newline at end of file
diff --git a/example/.node-version b/example/.node-version
new file mode 100644
index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0
--- /dev/null
+++ b/example/.node-version
@@ -0,0 +1 @@
+18
diff --git a/example/.prettierrc.js b/example/.prettierrc.js
new file mode 100644
index 0000000000000000000000000000000000000000..2ae7b381ed9590ddf3ba512a496dc8d53dadeea0
--- /dev/null
+++ b/example/.prettierrc.js
@@ -0,0 +1,7 @@
+module.exports = {
+ arrowParens: 'avoid',
+ bracketSameLine: true,
+ bracketSpacing: true,
+ singleQuote: true,
+ trailingComma: 'all',
+};
diff --git a/example/.watchmanconfig b/example/.watchmanconfig
new file mode 100644
index 0000000000000000000000000000000000000000..9e26dfeeb6e641a33dae4961196235bdb965b21b
--- /dev/null
+++ b/example/.watchmanconfig
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/example/app.json b/example/app.json
new file mode 100644
index 0000000000000000000000000000000000000000..7586f6fa99a6680a35a27fac7255ba721880d461
--- /dev/null
+++ b/example/app.json
@@ -0,0 +1,4 @@
+{
+ "name": "app_name",
+ "displayName": "tester"
+}
\ No newline at end of file
diff --git a/example/babel.config.js b/example/babel.config.js
new file mode 100644
index 0000000000000000000000000000000000000000..481136144aa7bed704ad81628802d8a43930a6a1
--- /dev/null
+++ b/example/babel.config.js
@@ -0,0 +1,5 @@
+module.exports = {
+ presets: ['module:metro-react-native-babel-preset'],
+ plugins: [
+ ],
+};
diff --git a/example/contexts.ts b/example/contexts.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9437598452691ccc56d19f5532607475aa5d33b4
--- /dev/null
+++ b/example/contexts.ts
@@ -0,0 +1,3 @@
+import React from 'react';
+
+export const AppParamsContext = React.createContext(undefined);
diff --git a/example/harmony/.gitignore b/example/harmony/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..72d73fb4b6240ccd907882c931ce08ee45ca62ba
--- /dev/null
+++ b/example/harmony/.gitignore
@@ -0,0 +1,24 @@
+# it may cause some issues when building the project when switching branches
+package-lock.json
+# we add this because we want to keep the signing configs out of git
+/build-profile.json5
+
+rnoh_modules
+
+**/oh-package-lock.json5
+# ---
+
+/node_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+/oh_modules
+hvigorw
+hvigorw.bat
+hvigor/hvigor-wrapper.js
+
diff --git a/example/harmony/AppScope/app.json5 b/example/harmony/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..058bd391dac60928a1857aa31e4b0f712a7bc743
--- /dev/null
+++ b/example/harmony/AppScope/app.json5
@@ -0,0 +1,10 @@
+{
+ "app": {
+ "bundleName": "com.harmony.wechat.lib.demo",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/example/harmony/AppScope/resources/base/element/string.json b/example/harmony/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..698a720065342ae0dadad63eb87d45fec8725f36
--- /dev/null
+++ b/example/harmony/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "RN Tester"
+ }
+ ]
+}
diff --git a/example/harmony/AppScope/resources/base/media/app_icon.png b/example/harmony/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/example/harmony/AppScope/resources/base/media/app_icon.png differ
diff --git a/example/harmony/build-profile.template.json5 b/example/harmony/build-profile.template.json5
new file mode 100644
index 0000000000000000000000000000000000000000..ee4cc5959ca1f90909c2f02ab4c7a16e0bedb1d2
--- /dev/null
+++ b/example/harmony/build-profile.template.json5
@@ -0,0 +1,40 @@
+{
+ "app": {
+ "products": [
+ {
+ "name": 'default',
+ "signingConfig": 'default',
+ "compileSdkVersion": '5.0.1(13)',
+ "compatibleSdkVersion": '5.0.0(12)',
+ "runtimeOS": 'HarmonyOS'
+ },
+ ],
+ "buildModeSet": [
+ {
+ "name": 'debug',
+ },
+ {
+ "name": 'release',
+ },
+ ],
+ "signingConfigs": []
+ },
+ "modules": [
+ {
+ "name": 'entry',
+ "srcPath": './entry',
+ "targets": [
+ {
+ "name": 'default',
+ "applyToProducts": [
+ 'default'
+ ],
+ },
+ ],
+ },
+ {
+ "name": "splash_screen",
+ "srcPath": '../../harmony/splash_screen'
+ }
+ ],
+}
\ No newline at end of file
diff --git a/example/harmony/codelinter.json b/example/harmony/codelinter.json
new file mode 100644
index 0000000000000000000000000000000000000000..e7f91acb037aeda939967a042f16033f4c6e21b9
--- /dev/null
+++ b/example/harmony/codelinter.json
@@ -0,0 +1,32 @@
+{
+ "files": ["**/*.ts", "**/*.ets"],
+ "ignore": [
+ "**/ohosTest/**/*",
+ "**/node_modules/**/*",
+ "**/hvigorfile.ts",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "plugins": ["@typescript-eslint"],
+ "ruleSet": [],
+ "rules": {
+ "@typescript-eslint/await-thenable": "warn",
+ "@typescript-eslint/consistent-type-imports": "warn",
+ "@typescript-eslint/explicit-function-return-type": "warn",
+ "@typescript-eslint/explicit-module-boundary-types": "warn",
+ "@typescript-eslint/no-dynamic-delete": "warn",
+ "@typescript-eslint/no-explicit-any": "warn",
+ "@typescript-eslint/no-for-in-array": "warn",
+ "@typescript-eslint/no-this-alias": "warn",
+ "@typescript-eslint/no-unnecessary-type-constraint": "warn",
+ "@typescript-eslint/no-unsafe-argument": "warn",
+ "@typescript-eslint/no-unsafe-assignment": "warn",
+ "@typescript-eslint/no-unsafe-call": "warn",
+ "@typescript-eslint/no-unsafe-member-access": "warn",
+ "@typescript-eslint/no-unsafe-return": "warn",
+ "@typescript-eslint/prefer-literal-enum-member": "warn"
+ },
+ "overrides": []
+}
diff --git a/example/harmony/entry/.gitignore b/example/harmony/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..bbc049cfeb689c61d6c2922810f652cbb19aad21
--- /dev/null
+++ b/example/harmony/entry/.gitignore
@@ -0,0 +1,7 @@
+/node_modules
+/.preview
+/build
+/.cxx
+package-lock.json
+/oh_modules
+/assets
diff --git a/example/harmony/entry/build-profile.json5 b/example/harmony/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..acd43012efed67cb22b141dab265981facbd08d6
--- /dev/null
+++ b/example/harmony/entry/build-profile.json5
@@ -0,0 +1,20 @@
+{
+ "apiType": 'stageMode',
+ "buildOption": {
+ "externalNativeOptions": {
+ "path": "./src/main/cpp/CMakeLists.txt",
+ "arguments": "",
+ "cppFlags": "-s",
+ "abiFilters": ["arm64-v8a", "x86_64"]
+ },
+ },
+ "targets": [
+ {
+ "name": "default",
+ "runtimeOS": "HarmonyOS"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/example/harmony/entry/hvigorfile.ts b/example/harmony/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..aced8afddf910b99762b7eff3a8df92cb9f30c2b
--- /dev/null
+++ b/example/harmony/entry/hvigorfile.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { hapTasks } from '@ohos/hvigor-ohos-plugin';
diff --git a/example/harmony/entry/oh-package.json5 b/example/harmony/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..6d63bd27f2fad81d510a41556e96953bc3f907c0
--- /dev/null
+++ b/example/harmony/entry/oh-package.json5
@@ -0,0 +1,11 @@
+{
+ "license": "ISC",
+ "devDependencies": {},
+ "name": "entry",
+ "description": "example description",
+ "version": "1.0.0",
+ "dependencies": {
+ "@rnoh/react-native-openharmony": "0.72.38",
+ "@react-native-ohos/react-native-splash-screen": "file:../../node_modules/@react-native-ohos/react-native-splash-screens/harmony/splash_screen.har"
+ }
+}
\ No newline at end of file
diff --git a/example/harmony/entry/src/main/cpp/.gitignore b/example/harmony/entry/src/main/cpp/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..881dde5479f322de9db2b2bb98fd94a95f73715e
--- /dev/null
+++ b/example/harmony/entry/src/main/cpp/.gitignore
@@ -0,0 +1,2 @@
+jsbundle.h
+generated/
diff --git a/example/harmony/entry/src/main/cpp/CMakeLists.txt b/example/harmony/entry/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e99719bc8343b67261a15a9857af49c768d4c9d6
--- /dev/null
+++ b/example/harmony/entry/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,35 @@
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(CMAKE_SKIP_BUILD_RPATH TRUE)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
+set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules/@rnoh/react-native-openharmony/src/main/cpp")
+set(RNOH_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/generated")
+set(LOG_VERBOSITY_LEVEL 1)
+set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
+set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
+set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+
+set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
+add_compile_definitions(WITH_HITRACE_SYSTRACE)
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: manual_package_linking_1
+add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-splash-screen/src/main/cpp" ./splash_screen)
+# RNOH_END: manual_package_linking_1
+
+file(GLOB GENERATED_CPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/generated/*.cpp") # this line is needed by codegen v1
+
+add_library(rnoh_app SHARED
+ ${GENERATED_CPP_FILES}
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: manual_package_linking_2
+target_link_libraries(rnoh_app PUBLIC rnoh_splash_screen)
+
+# RNOH_END: manual_package_linking_2
diff --git a/example/harmony/entry/src/main/cpp/PackageProvider.cpp b/example/harmony/entry/src/main/cpp/PackageProvider.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a759a6790f861c973a70a4ab2dbdb11d65dabb78
--- /dev/null
+++ b/example/harmony/entry/src/main/cpp/PackageProvider.cpp
@@ -0,0 +1,12 @@
+#include "RNOH/PackageProvider.h"
+#include "generated/RNOHGeneratedPackage.h"
+#include "SplashScreenPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx), // generated by codegen v1
+ std::make_shared(ctx)
+ };
+}
\ No newline at end of file
diff --git a/example/harmony/entry/src/main/ets/RNPackagesFactory.ets b/example/harmony/entry/src/main/ets/RNPackagesFactory.ets
new file mode 100644
index 0000000000000000000000000000000000000000..48d55b413501d2155e7c2fe04f1a7839aec15510
--- /dev/null
+++ b/example/harmony/entry/src/main/ets/RNPackagesFactory.ets
@@ -0,0 +1,32 @@
+/**
+ * MIT License
+ *
+ * Copyright (C) 2024 Huawei Device Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+import type {RNPackageContext, RNPackage} from '@rnoh/react-native-openharmony/ts';
+import {SplashScreenPackage} from '@react-native-ohos/react-native-splash-screen/ts';
+
+export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
+ return [
+ new SplashScreenPackage(ctx)
+ ];
+}
diff --git a/example/harmony/entry/src/main/ets/assets/fonts/Pacifico-Regular.ttf b/example/harmony/entry/src/main/ets/assets/fonts/Pacifico-Regular.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..e7def95d3f44c82086f6e74d93fc0aadac7c454a
Binary files /dev/null and b/example/harmony/entry/src/main/ets/assets/fonts/Pacifico-Regular.ttf differ
diff --git a/example/harmony/entry/src/main/ets/assets/fonts/StintUltraCondensed-Regular.ttf b/example/harmony/entry/src/main/ets/assets/fonts/StintUltraCondensed-Regular.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..25c749e167bd5beef18360b13ae660f1c10ebc62
Binary files /dev/null and b/example/harmony/entry/src/main/ets/assets/fonts/StintUltraCondensed-Regular.ttf differ
diff --git a/example/harmony/entry/src/main/ets/entryability/EntryAbility.ets b/example/harmony/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..6e3063a2b780317a967a8104a4a266433dbaac7f
--- /dev/null
+++ b/example/harmony/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
+ * Use of this source code is governed by a MIT license that can be
+ * found in the LICENSE file.
+ */
+
+import {RNAbility} from '@rnoh/react-native-openharmony';
+import { AbilityConstant, Want } from '@kit.AbilityKit';
+import { window } from '@kit.ArkUI';
+import { SplashScreen } from '@react-native-ohos/react-native-splash-screen/src/main/ets/SplashScreen'
+
+
+export default class EntryAbility extends RNAbility {
+
+ onCreate(want: Want) {
+ super.onCreate(want)
+ }
+
+ getPagePath() {
+ return 'pages/index';
+ }
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ let startWindowIcon = $r('app.media.app_icon'); // 启动页图片(用户改成自己 App 的启动图片,一般在 entry/src/main/resources/base/media 文件夹中)
+ let startWindowBackground = "#FFFFFF"; // 启动页背景色
+ let startPageUrl = 'pages/SplashScreenPage'; // 启动页
+ SplashScreen.show(this.context, windowStage, startWindowIcon, startWindowBackground, startPageUrl).then(() => {
+ super.onWindowStageCreate(windowStage);
+ })
+ }
+}
diff --git a/example/harmony/entry/src/main/ets/pages/Index.ets b/example/harmony/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5d4aa1e47485efbe3ddcffd5503e622c99463a46
--- /dev/null
+++ b/example/harmony/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
+ * Use of this source code is governed by a MIT license that can be
+ * found in the LICENSE file.
+ */
+
+import {
+ AnyJSBundleProvider,
+ ComponentBuilderContext,
+ FileJSBundleProvider,
+ MetroJSBundleProvider,
+ ResourceJSBundleProvider,
+ RNApp,
+ RNOHErrorDialog,
+ RNOHLogger,
+ TraceJSBundleProviderDecorator,
+ RNOHCoreContext
+} from '@rnoh/react-native-openharmony';
+import font from '@ohos.font';
+import { createRNPackages } from '../RNPackagesFactory';
+
+const arkTsComponentNames: Array = [
+];
+
+@Builder
+export function buildCustomRNComponent(ctx: ComponentBuilderContext) {
+ // There seems to be a problem with the placement of ArkTS components in mixed mode. Nested Stack temporarily avoided.
+ Stack() {
+ }
+ .position({ x: 0, y: 0 })
+
+}
+
+const wrappedCustomRNComponentBuilder = wrapBuilder(buildCustomRNComponent)
+
+/**
+ * If you want to use custom fonts, you need to register them here.
+ * We should support react-native-asset to handle registering fonts automatically.
+ */
+const fonts: font.FontOptions[] = [
+ {
+ familyName: 'Pacifico-Regular',
+ familySrc: '/assets/fonts/Pacifico-Regular.ttf'
+ },
+ {
+ familyName: 'StintUltraCondensed-Regular',
+ familySrc: '/assets/fonts/StintUltraCondensed-Regular.ttf'
+ }
+]
+
+@Entry
+@Component
+struct Index {
+ @StorageLink('RNOHCoreContext') private rnohCoreContext: RNOHCoreContext | undefined = undefined
+ @State shouldShow: boolean = false
+ private logger!: RNOHLogger
+ bundlePath: string = 'bunlde.harmony.js'
+ @State hasBundle: boolean = false
+
+ aboutToAppear() {
+ this.logger = this.rnohCoreContext!.logger.clone("Index")
+ const stopTracing = this.logger.clone("aboutToAppear").startTracing()
+ for (const customFont of fonts) {
+ font.registerFont(customFont)
+ }
+
+ this.shouldShow = true
+ stopTracing()
+ }
+
+ onBackPress(): boolean | undefined {
+ // NOTE: this is required since `Ability`'s `onBackPressed` function always
+ // terminates or puts the app in the background, but we want Ark to ignore it completely
+ // when handled by RN
+ this.rnohCoreContext!.dispatchBackPress()
+ return true
+ }
+
+ build() {
+ Column() {
+ if (this.rnohCoreContext && this.shouldShow) {
+ if (this.rnohCoreContext?.isDebugModeEnabled) {
+ RNOHErrorDialog({ ctx: this.rnohCoreContext })
+ }
+ RNApp({
+ rnInstanceConfig: {
+ createRNPackages,
+ enableNDKTextMeasuring: true,
+ enableBackgroundExecutor: false,
+ enableCAPIArchitecture: true,
+ arkTsComponentNames: arkTsComponentNames,
+ },
+ initialProps: { "foo": "bar" } as Record,
+ appKey: "app_name",
+ wrappedCustomRNComponentBuilder: wrappedCustomRNComponentBuilder,
+ onSetUp: (rnInstance) => {
+ rnInstance.enableFeatureFlag("ENABLE_RN_INSTANCE_CLEAN_UP")
+ },
+ jsBundleProvider: new TraceJSBundleProviderDecorator(
+ new AnyJSBundleProvider([
+ new MetroJSBundleProvider(),
+ // NOTE: to load the bundle from file, place it in
+ // `/data/app/el2/100/base/com.rnoh.tester/files/bundle.harmony.js`
+ // on your device. The path mismatch is due to app sandboxing on HarmonyOS
+ new FileJSBundleProvider('/data/storage/el2/base/files/bundle.harmony.js'),
+ // new FileJSBundleProvider(context.filesDir + '/' + this.bundlePath),
+ new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),
+ new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'bundle.harmony.js')
+ ]),
+ this.rnohCoreContext.logger),
+ })
+ }
+ Text("1233333333122 1212323")
+ }
+ .height('100%')
+ .width('100%')
+ }
+}
diff --git a/example/harmony/entry/src/main/ets/pages/SplashScreenPage.ets b/example/harmony/entry/src/main/ets/pages/SplashScreenPage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..829afabc95d8efc24acb3e5acd32ff9f2c9c5663
--- /dev/null
+++ b/example/harmony/entry/src/main/ets/pages/SplashScreenPage.ets
@@ -0,0 +1,11 @@
+import { SplashScreenView } from '@react-native-ohos/react-native-splash-screen/src/main/ets/SplashScreenView'
+
+@Entry
+@Component
+export struct SplashScreenPage {
+ build() {
+ Row() {
+ SplashScreenView();
+ }
+ }
+}
\ No newline at end of file
diff --git a/example/harmony/entry/src/main/ets/pages/SurfaceDeadlockTest.ets b/example/harmony/entry/src/main/ets/pages/SurfaceDeadlockTest.ets
new file mode 100644
index 0000000000000000000000000000000000000000..88e4439681c4981d7ab7e1b87a46653a9e5a9c35
--- /dev/null
+++ b/example/harmony/entry/src/main/ets/pages/SurfaceDeadlockTest.ets
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
+ * Use of this source code is governed by a MIT license that can be
+ * found in the LICENSE file.
+ */
+import { RNInstance, JSBundleProvider, RNAbility, RNSurface } from '@rnoh/react-native-openharmony'
+import { CustomComponentBuilder } from "@rnoh/react-native-openharmony/src/main/ets/RNOHCorePackage"
+import { SurfaceConfig2 } from '@rnoh/react-native-openharmony/src/main/ets/RNSurface'
+
+
+@Component
+export struct SurfaceDeadlockTest {
+ public jsBundleProvider: JSBundleProvider | undefined = undefined
+ public appKeys: string[] = []
+ public numberOfIterations: number = 1
+ @BuilderParam public buildCustomComponent!: CustomComponentBuilder
+ // -------------------------------------------------------------------------------------------------------------------
+ @StorageLink('RNAbility') private rnAbility: RNAbility = {} as RNAbility
+ private rnInstance!: RNInstance
+ @State private shouldShow: boolean = false
+ private shouldDestroyRNInstance: boolean = false
+ private cleanUpCallbacks: (() => void)[] = []
+
+ aboutToAppear() {
+ this.getOrCreateRNInstance().then(rnInstance => {
+ this.rnInstance = rnInstance
+ const jsBundleExecutionStatus = this.rnInstance.getBundleExecutionStatus(this.jsBundleProvider?.getURL())
+ if (this.jsBundleProvider && jsBundleExecutionStatus === undefined) {
+ this.rnInstance.runJSBundle(this.jsBundleProvider).then(() => {
+ this.shouldShow = true
+ })
+ return;
+ }
+ }).catch((reason: string | Error) => {
+ if (typeof reason === "string")
+ this.rnAbility.getLogger().error(reason)
+ else if (reason instanceof Error) {
+ this.rnAbility.getLogger().error(reason.message)
+ } else {
+ this.rnAbility.getLogger().error("Fatal exception")
+ }
+ })
+ }
+
+ aboutToDisappear() {
+ if (this.shouldDestroyRNInstance)
+ this.rnAbility.destroyAndUnregisterRNInstance(this.rnInstance)
+ this.cleanUpCallbacks.forEach(cleanUp => cleanUp())
+ }
+
+ private getOrCreateRNInstance(): Promise {
+ return this.rnAbility.createAndRegisterRNInstance({ createRNPackages: () => [] })
+ }
+
+ build() {
+ Stack() {
+ if (this.shouldShow) {
+ ForEach(this.appKeys, (appKey: string, idx) => {
+ Stack() {
+ Blinker({
+ minDelayInMs: 1000,
+ maxDelayInMs: 2000,
+ blinksCount: this.numberOfIterations,
+ randomnessPrecisionInMs: 500
+ }) {
+ RNSurface({
+ ctx: this.rnAbility.createRNOHContext({ rnInstance: this.rnInstance }),
+ surfaceConfig: {
+ initialProps: {},
+ appKey: appKey,
+ } as SurfaceConfig2,
+ buildCustomComponent: this.buildCustomComponent,
+ })
+ }
+ }.height(`${100 / this.appKeys.length}%`)
+ .position({ x: 0, y: `${(idx / this.appKeys.length) * 100}%` })
+ })
+ }
+ }.width("100%")
+ .height("100%")
+ }
+}
+
+
+@Component
+struct Blinker {
+ public minDelayInMs: number = 0
+ public maxDelayInMs: number = 1000
+ public blinksCount: number = 0
+ public randomnessPrecisionInMs: number = 250
+ @BuilderParam public renderChildren: () => void
+ private currentBlinksCount = 0
+ @State private isVisible: boolean = false
+ private timeout: number = 0
+
+ aboutToAppear() {
+ this.blink(this.minDelayInMs)
+ }
+
+ aboutToDisappear() {
+ clearTimeout(this.timeout)
+ }
+
+ private blink(ms: number) {
+ this.isVisible = !this.isVisible
+ this.currentBlinksCount += 1
+ if (this.currentBlinksCount >= this.blinksCount) {
+ if (this.timeout) {
+ clearTimeout(this.timeout)
+ }
+ this.isVisible = true
+ return;
+ }
+ this.timeout = setTimeout(() => {
+ this.blink(this.getNextDelay())
+ }, ms)
+ }
+
+ private getNextDelay(): number {
+ return ((Math.floor(Math.random() * (Number.MAX_VALUE / this.randomnessPrecisionInMs)) * this.randomnessPrecisionInMs) % this.maxDelayInMs) + this.minDelayInMs
+ }
+
+ build() {
+ Stack() {
+ if (this.isVisible) {
+ this.renderChildren()
+ }
+ }
+ }
+}
+
+
+
+
+
diff --git a/example/harmony/entry/src/main/ets/pages/TouchDisplayer.ets b/example/harmony/entry/src/main/ets/pages/TouchDisplayer.ets
new file mode 100644
index 0000000000000000000000000000000000000000..2c62df2983416a0fd5eca7e2e730283d139e0671
--- /dev/null
+++ b/example/harmony/entry/src/main/ets/pages/TouchDisplayer.ets
@@ -0,0 +1,37 @@
+@Component
+export struct TouchDisplayer {
+ @State currentTouches: TouchObject[] = []
+ @State touchIndicatorOpacity: number = 0
+ @BuilderParam buildChildren: () => void
+ build() {
+ Stack() {
+ this.buildChildren()
+ ForEach(this.currentTouches, (activeTouch: TouchObject) => {
+ Stack() {
+ }
+ .width(64)
+ .height(64)
+ .backgroundColor("blue")
+ .borderWidth(2)
+ .borderColor("white")
+ .opacity(this.touchIndicatorOpacity)
+ .position({ x: activeTouch.x - 32, y: activeTouch.y - 32 })
+ .borderRadius(1000)
+ .hitTestBehavior(HitTestMode.Transparent)
+ })
+ }
+ .width("100%")
+ .height("100%")
+ .hitTestBehavior(HitTestMode.Transparent)
+ .onTouch(e => {
+ this.currentTouches = e.touches
+ this.touchIndicatorOpacity = 0.5
+ animateTo({
+ duration: 500,
+ curve: Curve.Linear,
+ }, () => {
+ this.touchIndicatorOpacity = 0
+ })
+ })
+ }
+}
\ No newline at end of file
diff --git a/example/harmony/entry/src/main/module.json5 b/example/harmony/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c7700c2c5f348cd7d73ed4cf3b8d7112a46295b9
--- /dev/null
+++ b/example/harmony/entry/src/main/module.json5
@@ -0,0 +1,52 @@
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default"
+ ],
+ "querySchemes": [
+ "weixin",
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ // below property is supported from 5.0.0 - it is needed by bundleManager.canOpenLink to check if the app can open some url
+ // "querySchemes": ["maps", "http", "https", "customDomain"],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.INTERNET"
+ },
+ ],
+ "metadata": [
+ {
+ "name": "OPTLazyForEach",
+ "value": "true",
+ }
+ ],
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:icon",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:icon",
+ "startWindowBackground": "$color:start_window_background",
+ "visible": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/example/harmony/entry/src/main/resources/.gitignore b/example/harmony/entry/src/main/resources/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..037cea9e70bef8c906560a871a394f748ec2325d
--- /dev/null
+++ b/example/harmony/entry/src/main/resources/.gitignore
@@ -0,0 +1 @@
+rawfile/assets
diff --git a/example/harmony/entry/src/main/resources/base/element/color.json b/example/harmony/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/example/harmony/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/example/harmony/entry/src/main/resources/base/element/string.json b/example/harmony/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..074b2173f51352f71629252715526554911d44bb
--- /dev/null
+++ b/example/harmony/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "RN Tester"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/example/harmony/entry/src/main/resources/base/media/icon.png b/example/harmony/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..c0f05abe7eb110a3c4958a48f71ea15b28bae5d3
Binary files /dev/null and b/example/harmony/entry/src/main/resources/base/media/icon.png differ
diff --git a/example/harmony/entry/src/main/resources/base/profile/main_pages.json b/example/harmony/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..ce4c6a9f36ed823ce7f7e7c56c7e964aece01065
--- /dev/null
+++ b/example/harmony/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,6 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/SplashScreenPage"
+ ]
+}
diff --git a/example/harmony/entry/src/main/resources/rawfile/1.txt b/example/harmony/entry/src/main/resources/rawfile/1.txt
new file mode 100644
index 0000000000000000000000000000000000000000..71f6ee3dfcd13fad21fc73e697c7c5a3c31ec039
--- /dev/null
+++ b/example/harmony/entry/src/main/resources/rawfile/1.txt
@@ -0,0 +1 @@
+text test
\ No newline at end of file
diff --git a/example/harmony/format.ps1 b/example/harmony/format.ps1
new file mode 100644
index 0000000000000000000000000000000000000000..7735881fded75cc61ee05ec623e0848b85f6d639
--- /dev/null
+++ b/example/harmony/format.ps1
@@ -0,0 +1,12 @@
+$directoryPath = Split-Path -Parent $MyInvocation.MyCommand.Path
+$filePaths = Get-ChildItem $directoryPath -Recurse -Include *.h, *.cpp |
+Where-Object {
+ $_.DirectoryName -notmatch 'third-party' -and
+ $_.DirectoryName -notmatch 'patches' -and
+ $_.DirectoryName -notmatch 'node_modules' -and
+ $_.DirectoryName -notmatch '.cxx' -and
+ $_.DirectoryName -notmatch 'build'
+}
+foreach ($filePath in $filePaths) {
+ & "clang-format.exe" -style=file -i $filePath.FullName
+}
\ No newline at end of file
diff --git a/example/harmony/hvigor/.gitignore b/example/harmony/hvigor/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..aa1ec1ea0618124672d14a63d00d943240f2db2a
--- /dev/null
+++ b/example/harmony/hvigor/.gitignore
@@ -0,0 +1 @@
+*.tgz
diff --git a/example/harmony/hvigor/hvigor-config.json5 b/example/harmony/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c8ba182673e80fbc3da9e614580e9453b718cd3b
--- /dev/null
+++ b/example/harmony/hvigor/hvigor-config.json5
@@ -0,0 +1,21 @@
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
+ }
+}
\ No newline at end of file
diff --git a/example/harmony/hvigorfile.ts b/example/harmony/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6478186902c0c1ad7c966a929c7d6b7d8ae7a9f3
--- /dev/null
+++ b/example/harmony/hvigorfile.ts
@@ -0,0 +1,2 @@
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { appTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
diff --git a/example/harmony/oh-package.json5 b/example/harmony/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..fe6ab68c076ba72f6fc67f919699ff0862be86b2
--- /dev/null
+++ b/example/harmony/oh-package.json5
@@ -0,0 +1,12 @@
+{
+ "modelVersion": "5.0.0",
+ "license": "ISC",
+ "name": "rnoh",
+ "description": "example description",
+ "repository": {},
+ "version": "1.0.0",
+ "overrides": {
+ "@rnoh/react-native-openharmony": "0.72.38"
+ },
+ "dynamicDependencies": {}
+}
\ No newline at end of file
diff --git a/example/index.js b/example/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..4932f62d9918464a180789d7fd5f2666b9cea63f
--- /dev/null
+++ b/example/index.js
@@ -0,0 +1,5 @@
+import {AppRegistry, View, Text} from 'react-native';
+import {name as appName} from './app.json';
+import App from './src/SplashScreenDemo';
+
+AppRegistry.registerComponent(appName, () => App);
\ No newline at end of file
diff --git a/example/jest.config.js b/example/jest.config.js
new file mode 100644
index 0000000000000000000000000000000000000000..3745fc223702d5de74319e30d185b1dd5960d87b
--- /dev/null
+++ b/example/jest.config.js
@@ -0,0 +1,5 @@
+/** @type {import('ts-jest').JestConfigWithTsJest} */
+module.exports = {
+ preset: 'ts-jest',
+ testEnvironment: 'node',
+};
diff --git a/example/metro.config.js b/example/metro.config.js
new file mode 100644
index 0000000000000000000000000000000000000000..f33c325ac1fad6c7733a76bfe002d136fb442c8f
--- /dev/null
+++ b/example/metro.config.js
@@ -0,0 +1,24 @@
+const {mergeConfig, getDefaultConfig} = require('@react-native/metro-config');
+const {createHarmonyMetroConfig} = require('react-native-harmony/metro.config');
+
+/**
+ * @type {import("metro-config").ConfigT}
+ */
+const config = {
+ transformer: {
+ getTransformOptions: async () => ({
+ transform: {
+ experimentalImportSupport: false,
+ inlineRequires: true,
+ },
+ }),
+ },
+};
+
+module.exports = mergeConfig(
+ getDefaultConfig(__dirname),
+ createHarmonyMetroConfig({
+ reactNativeHarmonyPackageName: 'react-native-harmony',
+ }),
+ config,
+);
diff --git a/example/package.json b/example/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..fdc1ddc1ac2a37f2c176115ce7253af50d62f60b
--- /dev/null
+++ b/example/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "react-native-harmony-tester",
+ "version": "1.0.0",
+ "private": true,
+ "scripts": {
+ "i": "cd ../ && npm i && npm run pack && cd ./example && npm i",
+ "reStart": "npm run install:pkg && npm run codegen && hdc rport tcp:8081 tcp:8081 && react-native start",
+ "start": "hdc rport tcp:8081 tcp:8081 && react-native start",
+ "codegen": "react-native codegen-harmony --rnoh-module-path ./harmony/entry/oh_modules/@rnoh/react-native-openharmony",
+ "pack:pkg": "cd ../ && npm pack && cd ./example",
+ "install:pkg": "npm uninstall @react-native-ohos/react-native-splash-screen && npm run pack:pkg && npm i @react-native-ohos/react-native-splash-screens@file:../react-native-ohos-react-native-splash-screen-3.3.1-rc.1.tgz",
+ "dev": "npm run codegen && react-native bundle-harmony --dev --minify=false",
+ "prod": "npm run codegen && react-native bundle-harmony --dev=false --minify=true",
+ "postinstall": "node ./scripts/create-build-profile",
+ "fast:pkg": "cd ../ && npm i && npm pack && cd ./example && npm i && npm run dev"
+ },
+ "dependencies": {
+ "@gorhom/portal": "^1.0.14",
+ "@react-native-ohos/react-native-splash-screens": "file:../react-native-ohos-react-native-splash-screen-3.3.1-rc.1.tgz",
+ "@rnoh/testerino": "npm:@react-native-oh-tpl/testerino@0.0.9",
+ "react": "18.2.0",
+ "react-native": "0.72.5",
+ "react-native-harmony": "npm:@react-native-oh/react-native-harmony@^0.72.32"
+ },
+ "devDependencies": {
+ "@rnoh/react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27",
+ "@babel/core": "^7.20.0",
+ "@babel/preset-env": "^7.20.0",
+ "@babel/runtime": "^7.20.0",
+ "@react-native-community/eslint-config": "^3.2.0",
+ "@react-native/eslint-config": "^0.74.0",
+ "@react-native/metro-config": "^0.72.6",
+ "@tsconfig/react-native": "^2.0.2",
+ "@types/chai": "^4.3.4",
+ "@types/d3-scale-chromatic": "^3.0.0",
+ "@types/fs-extra": "^11.0.1",
+ "@types/jest": "^29.5.5",
+ "@types/metro-config": "^0.76.2",
+ "@types/react": "17.0.14",
+ "@types/react-dom": "17.0.14",
+ "@types/react-test-renderer": "^18.0.0",
+ "babel-jest": "^29.2.1",
+ "csv-parser": "^3.0.0",
+ "eslint": "^8.19.0",
+ "eslint-plugin-prettier": "^5.0.1",
+ "fs-extra": "^11.1.1",
+ "husky": "^8.0.3",
+ "jest": "^29.7.0",
+ "json5": "^2.2.3",
+ "metro": "^0.76.3",
+ "metro-config": "^0.76.3",
+ "metro-react-native-babel-preset": "0.73.9",
+ "prettier": "3.2.4",
+ "react-test-renderer": "18.2.0",
+ "simple-statistics": "^7.8.3",
+ "ts-jest": "^29.1.1",
+ "typescript": "^5.3.2",
+ "yargs": "^17.7.2"
+ },
+ "overrides": {
+ "@react-native-community/cli": "11.4.1",
+ "@react-native/codegen": "0.74.0"
+ },
+ "resolutions": {
+ "@react-native-community/cli": "11.4.1"
+ }
+}
diff --git a/example/react-native.config.js b/example/react-native.config.js
new file mode 100644
index 0000000000000000000000000000000000000000..4a038ab52d08072540e95ca80d06f5e6afe7e867
--- /dev/null
+++ b/example/react-native.config.js
@@ -0,0 +1,5 @@
+module.exports = {
+ project: {
+ },
+ assets: ['./assets/fonts/'],
+};
diff --git a/example/scripts/create-build-profile.js b/example/scripts/create-build-profile.js
new file mode 100644
index 0000000000000000000000000000000000000000..a7841d078f1258af521d389da9dc43c718903c6e
--- /dev/null
+++ b/example/scripts/create-build-profile.js
@@ -0,0 +1,39 @@
+const fs = require('fs');
+const JSON5 = require('json5');
+const path = require('path');
+
+const templatePath = path.join(
+ __dirname,
+ '..',
+ 'harmony',
+ 'build-profile.template.json5',
+);
+const existingProfilePath = path.join(
+ __dirname,
+ '..',
+ 'harmony',
+ 'build-profile.json5',
+);
+
+if (fs.existsSync(existingProfilePath)) {
+ let existingProfile = JSON5.parse(
+ fs.readFileSync(existingProfilePath, 'utf-8'),
+ );
+ let template = JSON5.parse(fs.readFileSync(templatePath, 'utf-8'));
+ let signingConfigs =
+ existingProfile.app && existingProfile.app.signingConfigs;
+
+ existingProfile = {...template};
+
+ if (signingConfigs) {
+ existingProfile.app.signingConfigs = signingConfigs;
+ }
+
+ fs.writeFileSync(
+ existingProfilePath,
+ JSON5.stringify(existingProfile, null, 2),
+ );
+} else {
+ // File doesn't exist, create a copy from the template
+ fs.copyFileSync(templatePath, existingProfilePath);
+}
\ No newline at end of file
diff --git a/example/src/SplashScreenDemo.tsx b/example/src/SplashScreenDemo.tsx
new file mode 100644
index 0000000000000000000000000000000000000000..0543cdf6a9d43368193deb4e2182f12d541900af
--- /dev/null
+++ b/example/src/SplashScreenDemo.tsx
@@ -0,0 +1,23 @@
+import React from 'react';
+import { Text, View } from 'react-native';
+import SplashScreen from 'react-native-splash-screen';
+
+class App extends React.Component {
+ componentDidMount() {
+ SplashScreen.hide();
+ }
+
+ render() {
+ return (
+
+ Hello, world!
+
+ )
+ }
+}
+
+export default App;
\ No newline at end of file
diff --git a/example/src/test/SplashScreenTest.tsx b/example/src/test/SplashScreenTest.tsx
new file mode 100644
index 0000000000000000000000000000000000000000..f0fa09c1e50d8d7d42d83689b105bbe71455eb63
--- /dev/null
+++ b/example/src/test/SplashScreenTest.tsx
@@ -0,0 +1,18 @@
+import { TestSuite, TestCase, Tester } from '@rnoh/testerino';
+import * as React from 'react';
+import SplashScreen from 'react-native-splash-screen';
+
+export function SplashScreenTest() {
+ return (
+
+
+ {
+ expect(SplashScreen.hide()).to.not.be.undefined;
+ }}
+ />
+
+
+ );
+}
diff --git a/example/tsconfig.json b/example/tsconfig.json
new file mode 100644
index 0000000000000000000000000000000000000000..9a2c8c222cb885dde1a7a015f7dfe57de4828c85
--- /dev/null
+++ b/example/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "extends": "@tsconfig/react-native/tsconfig.json",
+ "compilerOptions": {
+ "jsx": "react-native",
+ "paths": {
+ "react-native": [
+ "./node_modules/react-native-harmony"
+ ],
+ },
+ },
+ "exclude": [
+ "harmony"
+ ]
+}
\ No newline at end of file