diff --git a/.gitignore b/.gitignore
index 11485d9dc8cec10017e07d49962a27fa1059672d..b1cf507e1313d098937a3e4e07b37f648ccbdbaf 100755
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,8 @@ jspm_packages
# Optional REPL history
.node_repl_history
.idea
+
+# Dependency and build
+harmony/splash_screen/oh_modules/
+package-lock.json
+oh-package-lock.json5
\ No newline at end of file
diff --git a/OAT.xml b/OAT.xml
new file mode 100644
index 0000000000000000000000000000000000000000..aeef29d65e3a3596937096bb53dcee25bfc99763
--- /dev/null
+++ b/OAT.xml
@@ -0,0 +1,66 @@
+
+
+
+ LICENSE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 9eb674f98b7874c89d95ded9ce2da3f3bed4db6a..d00b83bcdfdcecb7b3f41055577b20aac5841d41 100644
--- a/README.md
+++ b/README.md
@@ -1,330 +1,9 @@
-# react-native-splash-screen
+# @react-native-ohos/react-native-splash-screen
+This project is based on [react-native-splash-screen](https://github.com/crazycodeboy/react-native-splash-screen)
+## Documentation
+[中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-splash-screen.md)
+[English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-splash-screen.md)
-[ ](https://www.npmjs.com/package/react-native-splash-screen)
-[ ](https://github.com/crazycodeboy/react-native-splash-screen/pulls)
-[ ](https://github.com/crazycodeboy/GitHubPopular/releases)
-[ ](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/README.zh.md)
-[](https://raw.githubusercontent.com/crazycodeboy/react-native-check-box/master/LICENSE)
-[ ](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%95%99%E7%A8%8B/React%20Native%20%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%95%99%E7%A8%8B.md)
-[ ](https://github.com/crazycodeboy/flutter_splash_screen)
-
-A splash screen API for react-native which can programatically hide and show the splash screen. Works on iOS and Android.
-
-## Content
-
-- [Changes](#changes)
-- [Installation](#installation)
-- [Examples](#examples)
-- [Getting started](#getting-started)
-- [API](#api)
-- [Testing](#testing)
-- [Troubleshooting](#troubleshooting)
-- [Contribution](#contribution)
-
-
-## Changes
-For React Native >= 0.47.0 use [v3.+](https://github.com/crazycodeboy/react-native-splash-screen/releases), for React Native < 0.47.0 use [v2.1.0](https://github.com/crazycodeboy/react-native-splash-screen/releases/tag/v1.0.9)
-
-## Examples
-* [Examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)
-
-
-
-
-
-
-## Installation
-
-### First step(Download):
-Run `npm i react-native-splash-screen --save`
-
-### Second step(Plugin Installation):
-
-#### Automatic installation
-
-`react-native link react-native-splash-screen` or `rnpm link react-native-splash-screen`
-
-#### Manual installation
-
-**Android:**
-
-1. In your `android/settings.gradle` file, make the following additions:
-```java
-include ':react-native-splash-screen'
-project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
-```
-
-2. In your android/app/build.gradle file, add the `:react-native-splash-screen` project as a compile-time dependency:
-
-```java
-...
-dependencies {
- ...
- implementation project(':react-native-splash-screen')
-}
-```
-
-3. Update the MainApplication.java file to use `react-native-splash-screen` via the following changes:
-
-```java
-// react-native-splash-screen >= 0.3.1
-import org.devio.rn.splashscreen.SplashScreenReactPackage;
-// react-native-splash-screen < 0.3.1
-import com.cboy.rn.splashscreen.SplashScreenReactPackage;
-
-public class MainApplication extends Application implements ReactApplication {
-
- private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
- @Override
- public boolean getUseDeveloperSupport() {
- return BuildConfig.DEBUG;
- }
-
- @Override
- protected List getPackages() {
- return Arrays.asList(
- new MainReactPackage(),
- new SplashScreenReactPackage() //here
- );
- }
- };
-
- @Override
- public ReactNativeHost getReactNativeHost() {
- return mReactNativeHost;
- }
-}
-```
-
-**iOS:**
-
-1. `cd ios`
-2. `run pod install`
-
->OR
-
-1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
-2. Go to `node_modules` ➜ `react-native-splash-screen` and add `SplashScreen.xcodeproj`
-3. In XCode, in the project navigator, select your project. Add `libSplashScreen.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
-4. To fix `'RNSplashScreen.h' file not found`, you have to select your project → Build Settings → Search Paths → Header Search Paths to add:
-
- `$(SRCROOT)/../node_modules/react-native-splash-screen/ios`
-
-
-
-### Third step(Plugin Configuration):
-
-**Android:**
-
-Update the `MainActivity.java` to use `react-native-splash-screen` via the following changes:
-
-```java
-import android.os.Bundle; // here
-import com.facebook.react.ReactActivity;
-// react-native-splash-screen >= 0.3.1
-import org.devio.rn.splashscreen.SplashScreen; // here
-// react-native-splash-screen < 0.3.1
-import com.cboy.rn.splashscreen.SplashScreen; // here
-
-public class MainActivity extends ReactActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- SplashScreen.show(this); // here
- super.onCreate(savedInstanceState);
- }
- // ...other code
-}
-```
-
-**iOS:**
-
-Update `AppDelegate.m` with the following additions:
-
-
-```obj-c
-#import "AppDelegate.h"
-
-#import
-#import
-#import "RNSplashScreen.h" // here
-
-@implementation AppDelegate
-
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
-{
- // ...other code
-
- [RNSplashScreen show]; // here
- // or
- //[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];
- return YES;
-}
-
-@end
-
-```
-
-## Getting started
-
-Import `react-native-splash-screen` in your JS file.
-
-`import SplashScreen from 'react-native-splash-screen'`
-
-### Android:
-
-Create a file called `launch_screen.xml` in `app/src/main/res/layout` (create the `layout`-folder if it doesn't exist). The contents of the file should be the following:
-
-```xml
-
-
-
-
-```
-
-Customize your launch screen by creating a `launch_screen.png`-file and placing it in an appropriate `drawable`-folder. Android automatically scales drawable, so you do not necessarily need to provide images for all phone densities.
-You can create splash screens in the following folders:
-* `drawable-ldpi`
-* `drawable-mdpi`
-* `drawable-hdpi`
-* `drawable-xhdpi`
-* `drawable-xxhdpi`
-* `drawable-xxxhdpi`
-
-Add a color called `primary_dark` in `app/src/main/res/values/colors.xml`
-
-```
-
-
- #000000
-
-```
-
-
-**Optional steps:**
-
-If you want the splash screen to be transparent, follow these steps.
-
-Open `android/app/src/main/res/values/styles.xml` and add `- true
` to the file. It should look like this:
-
-```xml
-
-
-
-
-```
-
-**To learn more see [examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)**
-
-
-If you want to customize the color of the status bar when the splash screen is displayed:
-
-Create `android/app/src/main/res/values/colors.xml` and add
-```xml
-
-
-
-
-```
-
-Create a style definition for this in `android/app/src/main/res/values/styles.xml`:
-```xml
-
-
-
-
-```
-
-Change your `show` method to include your custom style:
-```java
-SplashScreen.show(this, R.style.SplashScreenTheme);
-```
-
-### iOS
-
-Customize your splash screen via `LaunchScreen.storyboard` or `LaunchScreen.xib`。
-
-**Learn more to see [examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)**
-
-- [via LaunchScreen.storyboard Tutorial](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/add-LaunchScreen-tutorial-for-ios.md)
-
-
-## Usage
-
-Use like so:
-
-```javascript
-import SplashScreen from 'react-native-splash-screen'
-
-export default class WelcomePage extends Component {
-
- componentDidMount() {
- // do stuff while splash screen is shown
- // After having done stuff (such as async tasks) hide the splash screen
- SplashScreen.hide();
- }
-}
-```
-
-## API
-
-
-| Method | Type | Optional | Description |
-|--------|----------|----------|-------------------------------------|
-| show() | function | false | Open splash screen (Native Method ) |
-| show(final Activity activity, final boolean fullScreen) | function | false | Open splash screen (Native Method ) |
-| hide() | function | false | Close splash screen |
-
-## Testing
-
-### Jest
-
-For Jest to work you will need to mock this component. Here is an example:
-
-```
-// __mocks__/react-native-splash-screen.js
-export default {
- show: jest.fn().mockImplementation( () => { console.log('show splash screen'); } ),
- hide: jest.fn().mockImplementation( () => { console.log('hide splash screen'); } ),
-}
-```
-
-## Troubleshooting
-
-### Splash screen always appears stretched/distorted
-Add the ImageView with a scaleType in the `launch_screen.xml`, e.g.:
-```
-
-
-
-
-
-```
-
-## Contribution
-
-Issues are welcome. Please add a screenshot of you bug and a code snippet. Quickest way to solve issue is to reproduce it in one of the examples.
-
-Pull requests are welcome. If you want to change the API or do something big it is best to create an issue and discuss it first.
-
----
-
-**[MIT Licensed](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/LICENSE)**
+## License
+This library is licensed under [The MIT License (MIT)](https://gitee.com/openharmony-sig/rntpc_react-native-splash-screen/blob/master/LICENSE).
diff --git a/README.zh.md b/README.zh.md
deleted file mode 100644
index f3a9beb07b926a0f0bcf087c2b8ee680a7429b23..0000000000000000000000000000000000000000
--- a/README.zh.md
+++ /dev/null
@@ -1,232 +0,0 @@
-# react-native-splash-screen
-
-[ ](https://www.npmjs.com/package/react-native-splash-screen)
-[ ](https://github.com/crazycodeboy/react-native-splash-screen/pulls)
-[ ](https://github.com/crazycodeboy/GitHubPopular/releases)
-[ ](https://github.com/crazycodeboy/GitHubPopular/)
-[](https://raw.githubusercontent.com/crazycodeboy/react-native-check-box/master/LICENSE)
-[ ](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%95%99%E7%A8%8B/React%20Native%20%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%95%99%E7%A8%8B.md)
-
-
-
-React Native启动屏,解决iOS,Android启动白屏问题,支持Android和iOS。
-
-## 目录
-
-- [安装说明](#安装说明)
-- [演示](#演示)
-- [使用说明](#使用说明)
-- [API](#api)
-- [贡献](#贡献)
-- [改变](#改变)
-
-## 演示
-* [Examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)
-
-
-
-
-
-## 改变
-
-如果你项目的React Native>=0.47.请使用[v3.+](https://github.com/crazycodeboy/react-native-splash-screen/releases),
-如果<0.47.0请使用[v2.1.0](https://github.com/crazycodeboy/react-native-splash-screen/releases/tag/v1.0.9)。
-
-## 安装说明
-
-### 第一步(下载):
-在项目根目录打开终端运行 `npm i react-native-splash-screen --save`
-
-### 第二步 (安装):
-
-大家可以通过自动或手动两种方式来安装`react-native-splash-screen`。
-
-
-#### 自动安装
-
-终端运行:
-
-
-`react-native link react-native-splash-screen` 或 `rnpm link react-native-splash-screen`
-
-#### 手动安装
-
-**Android:**
-
-1.在你的 android/settings.gradle 文件中添加下列代码:
-```
-include ':react-native-splash-screen'
-project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
-```
-
-2.在你的 android/app/build.gradle 文件中添加 `:react-native-splash-screen`:
-
-代码如下:
-
-```
-...
-dependencies {
- ...
- implementation project(':react-native-splash-screen')
-}
-```
-
-3.更新你的MainApplication.java 文件,如下:
-
-```java
-public class MainApplication extends Application implements ReactApplication {
-
- private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
- @Override
- protected boolean getUseDeveloperSupport() {
- return BuildConfig.DEBUG;
- }
-
- @Override
- protected List getPackages() {
- return Arrays.asList(
- new MainReactPackage(),
- new SplashScreenReactPackage() //添加这一句
- );
- }
- };
-
- @Override
- public ReactNativeHost getReactNativeHost() {
- return mReactNativeHost;
- }
-}
-```
-
-**iOS:**
-
-1. 在 XCode的项目导航视图中单击 `Libraries` ➜ `Add Files to [your project's name]`
-2. 将 `SplashScreen.xcodeproj`添加到你的项目中,`node_modules` ➜ `react-native-splash-screen` ➜ `SplashScreen.xcodeproj`
-
-3. 在XCode中打开`Build Phases` ➜ `Link Binary With Libraries`将`libSplashScreen.a` 添加到你的项目中。
-4. 如果在使用过过程中出现 `'SplashScreen.h' file not found`问题,你可以下面的代码添加到Header Search Paths中,步骤如下:
-
-
-选择你的项目,TARGET → Build Settings → Search Paths → Header Search Paths 添加:
-
- `$(SRCROOT)/../node_modules/react-native-splash-screen/ios`
-
-
-### 第三步(配置):
-
-**Android:**
-
-更新你的 MainActivity.java 文件如下:
-```java
-public class MainActivity extends ReactActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- SplashScreen.show(this); // 添加这一句
- super.onCreate(savedInstanceState);
- }
- // ...other code
-}
-```
-
-**iOS:**
-
-更新你的AppDelegate.m 文件如下:
-
-
-```obj-c
-#import "AppDelegate.h"
-
-#import
-#import
-#import "RNSplashScreen.h" // 添加这一句
-
-@implementation AppDelegate
-
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
-{
- // ...other code
-
- [RNSplashScreen show]; // 添加这一句,这一句一定要在最后
- return YES;
-}
-
-@end
-
-```
-
-
-## 使用说明
-
-将 `react-native-splash-screen` 导入你的JS 文件。
-
-
-`import SplashScreen from 'react-native-splash-screen'`
-
-**Android:**
-
-创建一个名为 launch_screen.xml 的布局文件来自定义你的启动屏幕。
-
-```
-
-
-
-```
-
-**另外:**
-
-你也可以启用app主题透明选项来解决在APP启动时因主题原因导致的短暂白屏的问题,具体步骤如下:
-
-打开 `android/app/src/main/res/values/styles.xml`文件,添加 `- true
`,如下 :
-
-```xml
-
-
-
-
-```
-
-
-**更详细的介绍,可以查看 [examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)**
-
-**iOS**
-
-iOS可以通过LaunchScreen.storyboard或LaunchScreen.xib来自定义你的启动屏幕。
-
-**更详细的介绍,可以查看 [examples](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/examples)**
-
-最后,你可以在适当的时候关闭启动屏幕(如:启动初始化完成后):
-
-```JavaScript
-import SplashScreen from 'react-native-splash-screen'
-
-export default class WelcomePage extends Component {
-
- componentDidMount() {
- // do anything while splash screen keeps, use await to wait for an async task.
- SplashScreen.hide();//关闭启动屏幕
- }
-}
-```
-
-## API
-
-
-方法 | 类型 | 可选 | 描述
------------------ | -------- | -------- | -----------
-show() | function | false | 打开启动屏幕(原生方法)
-hide() | function | false | 关闭启动屏幕
-
-## 贡献
-
-欢迎大家提问题,如果能给问题加上一个截图,则是极好的。另外欢迎`Pull requests`贡献你的代码。
-
----
-
-**MIT Licensed**
diff --git a/add-LaunchScreen-tutorial-for-ios.md b/add-LaunchScreen-tutorial-for-ios.md
deleted file mode 100644
index b62cccad8bc169f6b415b96139058f9538478e71..0000000000000000000000000000000000000000
--- a/add-LaunchScreen-tutorial-for-ios.md
+++ /dev/null
@@ -1,34 +0,0 @@
-在新版Xcode 中 而LaunchImage已经退出了历史的舞台,要为iOS APP添加启动屏可以通过LaunchScreen.storyboard 或 LaunchScreen.xib两种方式,两种方式思路相同,接下来就介绍下如何通过LaunchScreen.storyboard 来为RN应用添加启动屏。
-
-## 步骤
-
-1. 创建LaunchScreen.storyboard
-2. 创建LaunchScreen Image Set
-3. 在LaunchScreen.storyboard中添加ImageView并绑定LaunchScreen Image
-4. 应用LaunchScreen.storyboard
-5. 删除APP,重新运行
-
-### 创建LaunchScreen.storyboard
-
-RN创建的项目默认是不带LaunchScreen.storyboard的,所以我们需要手动创建,用xcode打开项目下的iOS项目然后在左侧文件导航面板右键选择新建文件:
-
-
-
-
-### 创建LaunchScreen Image Set
-
-打开`Images.xcassets`然后添加名为`LaunchScreen`的Image Set:
-
-
-
-### 在LaunchScreen.storyboard中添加ImageView并绑定LaunchScreen Image
-
-打开`LaunchScreen.storyboard`,然后添加一个ImageView,调整好大小与约束,在为其绑定LaunchScreen Image Set:
-
-
-
-### 应用LaunchScreen.storyboard
-
-然后不要忘记在TARGETS中设置`Launch Screen File`:
-
-
\ No newline at end of file
diff --git a/harmony/splash_screen.har b/harmony/splash_screen.har
new file mode 100644
index 0000000000000000000000000000000000000000..fbadf968ae886331a7bb814f1363cfea55d9a2fb
Binary files /dev/null and b/harmony/splash_screen.har differ
diff --git a/harmony/splash_screen/build-profile.json5 b/harmony/splash_screen/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..14d5b832c7c04a429ed7da4c443d19c2566a4f25
--- /dev/null
+++ b/harmony/splash_screen/build-profile.json5
@@ -0,0 +1,8 @@
+{
+ "apiType": "stageMode",
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/harmony/splash_screen/hvigorfile.ts b/harmony/splash_screen/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..dcf8c985dffd2987fabc13175a294d94ffa2a1cb
--- /dev/null
+++ b/harmony/splash_screen/hvigorfile.ts
@@ -0,0 +1,23 @@
+/**
+ * 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.
+ */
+
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
diff --git a/harmony/splash_screen/index.ets b/harmony/splash_screen/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..223be4db18f35ae81c9501cdb8f36b8b021ea1df
--- /dev/null
+++ b/harmony/splash_screen/index.ets
@@ -0,0 +1,23 @@
+/**
+ * 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.
+ */
+
+export * from "./src/main/ets/SplashScreenView"
diff --git a/harmony/splash_screen/oh-package.json5 b/harmony/splash_screen/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..8145a6c36e517f806feabafd60eaaa310131ee7b
--- /dev/null
+++ b/harmony/splash_screen/oh-package.json5
@@ -0,0 +1,13 @@
+{
+ "license": "MIT",
+ "types": "",
+ "devDependencies": {},
+ "name": "@react-native-ohos/react-native-splash-screen",
+ "description": "",
+ "main": "index.ets",
+ "type": "module",
+ "version": "3.3.0",
+ "dependencies": {
+ "@rnoh/react-native-openharmony": "^0.72.38",
+ }
+}
\ No newline at end of file
diff --git a/harmony/splash_screen/src/main/cpp/CMakeLists.txt b/harmony/splash_screen/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..cc09e0b60aebd7d245fc25a33d87f77a28fcf6ac
--- /dev/null
+++ b/harmony/splash_screen/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.13)
+set(CMAKE_VERBOSE_MAKEFILE on)
+
+set(rnoh_splash_screen_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated")
+file(GLOB_RECURSE rnoh_splash_screen_generated_SRC "${rnoh_splash_screen_generated_dir}/**/*.cpp")
+file(GLOB rnoh_splash_screen_SRC CONFIGURE_DEPENDS *.cpp)
+add_library(rnoh_splash_screen SHARED ${rnoh_splash_screen_SRC} ${rnoh_splash_screen_generated_SRC})
+target_include_directories(rnoh_splash_screen PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_splash_screen_generated_dir})
+target_link_libraries(rnoh_splash_screen PUBLIC rnoh)
\ No newline at end of file
diff --git a/harmony/splash_screen/src/main/cpp/SplashScreenPackage.h b/harmony/splash_screen/src/main/cpp/SplashScreenPackage.h
new file mode 100644
index 0000000000000000000000000000000000000000..c997b0567feefdaa7a4afcb3960ca6288ee96480
--- /dev/null
+++ b/harmony/splash_screen/src/main/cpp/SplashScreenPackage.h
@@ -0,0 +1,32 @@
+/**
+ * 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.
+ */
+
+#pragma once
+
+#include "generated/RNOH/generated/BaseReactNativeOhosReactNativeSplashScreenPackage.h"
+
+namespace rnoh {
+class SplashScreenPackage : public BaseReactNativeOhosReactNativeSplashScreenPackage {
+ using Super = BaseReactNativeOhosReactNativeSplashScreenPackage;
+ using Super::Super;
+ };
+} // namespace rnoh
\ No newline at end of file
diff --git a/harmony/splash_screen/src/main/cpp/generated/RNOH/generated/BaseReactNativeOhosReactNativeSplashScreenPackage.h b/harmony/splash_screen/src/main/cpp/generated/RNOH/generated/BaseReactNativeOhosReactNativeSplashScreenPackage.h
new file mode 100644
index 0000000000000000000000000000000000000000..6918086f30aa0e9f39fc4a006fae791534ee54c7
--- /dev/null
+++ b/harmony/splash_screen/src/main/cpp/generated/RNOH/generated/BaseReactNativeOhosReactNativeSplashScreenPackage.h
@@ -0,0 +1,65 @@
+/**
+ * This code was generated by "react-native codegen-lib-harmony"
+ */
+
+#pragma once
+
+#include "RNOH/Package.h"
+#include "RNOH/ArkTSTurboModule.h"
+#include "RNOH/generated/turbo_modules/SplashScreen.h"
+
+namespace rnoh {
+
+class BaseReactNativeOhosReactNativeSplashScreenPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
+ public:
+ SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
+ if (name == "SplashScreen") {
+ return std::make_shared(ctx, name);
+ }
+ return nullptr;
+ };
+};
+
+class BaseReactNativeOhosReactNativeSplashScreenPackageEventEmitRequestHandler : public EventEmitRequestHandler {
+ public:
+ void handleEvent(Context const &ctx) override {
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter(ctx.tag);
+ if (eventEmitter == nullptr) {
+ return;
+ }
+
+ std::vector supportedEventNames = {
+ };
+ if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
+ eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
+ }
+ }
+};
+
+
+class BaseReactNativeOhosReactNativeSplashScreenPackage : public Package {
+ public:
+ BaseReactNativeOhosReactNativeSplashScreenPackage(Package::Context ctx) : Package(ctx){};
+
+ std::unique_ptr createTurboModuleFactoryDelegate() override {
+ return std::make_unique();
+ }
+
+ std::vector createComponentDescriptorProviders() override {
+ return {
+ };
+ }
+
+ ComponentJSIBinderByString createComponentJSIBinderByName() override {
+ return {
+ };
+ };
+
+ EventEmitRequestHandlers createEventEmitRequestHandlers() override {
+ return {
+ std::make_shared(),
+ };
+ }
+};
+
+} // namespace rnoh
diff --git a/harmony/splash_screen/src/main/cpp/generated/RNOH/generated/turbo_modules/SplashScreen.cpp b/harmony/splash_screen/src/main/cpp/generated/RNOH/generated/turbo_modules/SplashScreen.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1cbae51920e64270b2f6367e7b9391d614a8a99e
--- /dev/null
+++ b/harmony/splash_screen/src/main/cpp/generated/RNOH/generated/turbo_modules/SplashScreen.cpp
@@ -0,0 +1,16 @@
+/**
+ * This code was generated by "react-native codegen-lib-harmony"
+ */
+
+#include "SplashScreen.h"
+
+namespace rnoh {
+using namespace facebook;
+
+SplashScreen::SplashScreen(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
+ methodMap_ = {
+ ARK_METHOD_METADATA(hide, 0),
+ };
+}
+
+} // namespace rnoh
diff --git a/harmony/splash_screen/src/main/cpp/generated/RNOH/generated/turbo_modules/SplashScreen.h b/harmony/splash_screen/src/main/cpp/generated/RNOH/generated/turbo_modules/SplashScreen.h
new file mode 100644
index 0000000000000000000000000000000000000000..e97801b2bd36065e467ee7cb2f6b79d6ec984422
--- /dev/null
+++ b/harmony/splash_screen/src/main/cpp/generated/RNOH/generated/turbo_modules/SplashScreen.h
@@ -0,0 +1,16 @@
+/**
+ * This code was generated by "react-native codegen-lib-harmony"
+ */
+
+#pragma once
+
+#include "RNOH/ArkTSTurboModule.h"
+
+namespace rnoh {
+
+class JSI_EXPORT SplashScreen : public ArkTSTurboModule {
+ public:
+ SplashScreen(const ArkTSTurboModule::Context ctx, const std::string name);
+};
+
+} // namespace rnoh
diff --git a/harmony/splash_screen/src/main/ets/Logger.ts b/harmony/splash_screen/src/main/ets/Logger.ts
new file mode 100644
index 0000000000000000000000000000000000000000..af6b0dfeb1d1883cdc328d4145dd223583b2d3f3
--- /dev/null
+++ b/harmony/splash_screen/src/main/ets/Logger.ts
@@ -0,0 +1,62 @@
+/**
+ * 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 hilog from '@ohos.hilog';
+
+class Logger {
+ private domain: number;
+ private prefix: string;
+ private format: string = '%{public}s, %{public}s';
+ private isDebug: boolean;
+
+ /**
+ * constructor.
+ *
+ * @param Prefix Identifies the log tag.
+ * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
+ */
+ constructor(prefix: string = 'SplashScreen', domain: number = 0xFF00, isDebug = false) {
+ this.prefix = prefix;
+ this.domain = domain;
+ this.isDebug = isDebug;
+ }
+
+ debug(...args: string[]): void {
+ if (this.isDebug) {
+ hilog.debug(this.domain, this.prefix, this.format, args);
+ }
+ }
+
+ info(...args: string[]): void {
+ hilog.info(this.domain, this.prefix, this.format, args);
+ }
+
+ warn(...args: string[]): void {
+ hilog.warn(this.domain, this.prefix, this.format, args);
+ }
+
+ error(...args: string[]): void {
+ hilog.error(this.domain, this.prefix, this.format, args);
+ }
+}
+
+export default new Logger('SplashScreen', 0xFF00, false)
\ No newline at end of file
diff --git a/harmony/splash_screen/src/main/ets/SplashScreen.ts b/harmony/splash_screen/src/main/ets/SplashScreen.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5a2b8c8f2ee8917e5b815218ca7f5b7da2d4d4b8
--- /dev/null
+++ b/harmony/splash_screen/src/main/ets/SplashScreen.ts
@@ -0,0 +1,105 @@
+/**
+ * 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 { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
+import { TM } from './generated/ts'
+import window from '@ohos.window';
+import image from '@ohos.multimedia.image';
+import Logger from './Logger';
+
+export class SplashScreen extends TurboModule implements TM.SplashScreen.Spec {
+ static NAME = "SplashScreen"
+
+ // 启动图片
+ public static startWindowIcon;
+
+ // 子窗口
+ private static splashWindow;
+
+ constructor(ctx: TurboModuleContext) {
+ super(ctx)
+ }
+
+ /**
+ * 显示启动屏
+ *
+ */
+ public static async show(abilityContext: any,
+ windowStage: window.WindowStage,
+ iconResource: any,
+ backgroundColor: string,
+ pageUrl: string) {
+ // 获取resourceManager资源管理
+ const context = abilityContext;
+ const resourceMgr = context.resourceManager
+ // 获取rawfile文件夹下startIcon的ArrayBuffer
+ const fileData = await resourceMgr.getMediaContent(iconResource)
+ const buffer = fileData.buffer
+ // 创建imageSource
+ const imageSource = image.createImageSource(buffer)
+ // 创建PixelMap
+ const pixelMap = await imageSource.createPixelMap()
+ this.startWindowIcon = pixelMap;
+
+ // 创建子窗口
+ windowStage.createSubWindow("SplashScreenWindow", (err, data) => {
+ if (err.code) {
+ Logger.error('Failed to create the subwindow. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ this.splashWindow = data;
+
+ // 设置子窗口全屏
+ this.splashWindow.setFullScreen(true);
+
+ // 为子窗口加载对应的目标页面
+ this.splashWindow.setUIContent(pageUrl, (err) => {
+ if (err.code) {
+ Logger.error('Failed to load the content. Cause:' + JSON.stringify(err));
+ return;
+ }
+ // 显示子窗口
+ this.splashWindow.showWindow((err) => {
+ if (err.code) {
+ Logger.error('Failed to show the window. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ Logger.debug('Succeeded in showing the window.');
+ });
+ this.splashWindow.setWindowBackgroundColor(backgroundColor)
+ });
+ })
+ }
+
+ /**
+ * 关闭启动屏
+ */
+ public hide() {
+ // 销毁子窗口
+ SplashScreen.splashWindow.destroyWindow((err) => {
+ if (err.code) {
+ Logger.error('Failed to destroy the window. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ });
+ }
+}
diff --git a/harmony/splash_screen/src/main/ets/SplashScreenPackage.ts b/harmony/splash_screen/src/main/ets/SplashScreenPackage.ts
new file mode 100644
index 0000000000000000000000000000000000000000..03bb0fe0d8bd06caa0952a903bb22938e923ad16
--- /dev/null
+++ b/harmony/splash_screen/src/main/ets/SplashScreenPackage.ts
@@ -0,0 +1,44 @@
+/**
+ * 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 { RNPackage, TurboModuleContext, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
+import type { TurboModule } from '@rnoh/react-native-openharmony/ts';
+import { SplashScreen } from './SplashScreen';
+
+class SplashScreenTurboModulesFactory extends TurboModulesFactory {
+ createTurboModule(name: string): TurboModule | null {
+ if (name === SplashScreen.NAME) {
+ return new SplashScreen(this.ctx);
+ }
+ return null;
+ }
+
+ hasTurboModule(name: string): boolean {
+ return name === SplashScreen.NAME;
+ }
+}
+
+export class SplashScreenPackage extends RNPackage {
+ createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
+ return new SplashScreenTurboModulesFactory(ctx);
+ }
+}
diff --git a/harmony/splash_screen/src/main/ets/SplashScreenView.ets b/harmony/splash_screen/src/main/ets/SplashScreenView.ets
new file mode 100644
index 0000000000000000000000000000000000000000..05a9a3eb47edb139e8e4e9a98a54f1c6de05dc96
--- /dev/null
+++ b/harmony/splash_screen/src/main/ets/SplashScreenView.ets
@@ -0,0 +1,34 @@
+/**
+ * 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 { SplashScreen } from './SplashScreen'
+
+@Component
+export struct SplashScreenView {
+ build() {
+ Row() {
+ Image(SplashScreen.startWindowIcon).objectFit(ImageFit.Cover)
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/harmony/splash_screen/src/main/ets/generated/components/ts.ts b/harmony/splash_screen/src/main/ets/generated/components/ts.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d1dae5612c329e2d338cb21936a3aadf279efcc5
--- /dev/null
+++ b/harmony/splash_screen/src/main/ets/generated/components/ts.ts
@@ -0,0 +1,5 @@
+
+/**
+ */
+
+export {}
diff --git a/harmony/splash_screen/src/main/ets/generated/index.ets b/harmony/splash_screen/src/main/ets/generated/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..041b7edf42bfd5af1779aa40009e5d5e53e2152f
--- /dev/null
+++ b/harmony/splash_screen/src/main/ets/generated/index.ets
@@ -0,0 +1,5 @@
+/**
+ * This code was generated by "react-native codegen-lib-harmony"
+ */
+
+export * from "./ts"
diff --git a/harmony/splash_screen/src/main/ets/generated/ts.ts b/harmony/splash_screen/src/main/ets/generated/ts.ts
new file mode 100644
index 0000000000000000000000000000000000000000..4c568a8e486aaafd28ba432cf802ae5277923d56
--- /dev/null
+++ b/harmony/splash_screen/src/main/ets/generated/ts.ts
@@ -0,0 +1,6 @@
+/**
+ * This code was generated by "react-native codegen-lib-harmony"
+ */
+
+export * as RNC from "./components/ts"
+export * as TM from "./turboModules/ts"
diff --git a/harmony/splash_screen/src/main/ets/generated/turboModules/SplashScreen.ts b/harmony/splash_screen/src/main/ets/generated/turboModules/SplashScreen.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0efb51213576f66a69b8b0140f8f2c71c5d9a7b7
--- /dev/null
+++ b/harmony/splash_screen/src/main/ets/generated/turboModules/SplashScreen.ts
@@ -0,0 +1,14 @@
+/**
+ * This code was generated by "react-native codegen-lib-harmony"
+ */
+
+import { Tag } from "@rnoh/react-native-openharmony/ts"
+
+export namespace SplashScreen {
+ export const NAME = 'SplashScreen' as const
+
+ export interface Spec {
+ hide(): void;
+
+ }
+}
diff --git a/harmony/splash_screen/src/main/ets/generated/turboModules/ts.ts b/harmony/splash_screen/src/main/ets/generated/turboModules/ts.ts
new file mode 100644
index 0000000000000000000000000000000000000000..40cae33f77fe58e34c7cd74958609556f766e760
--- /dev/null
+++ b/harmony/splash_screen/src/main/ets/generated/turboModules/ts.ts
@@ -0,0 +1,5 @@
+/**
+ * This code was generated by "react-native codegen-lib-harmony"
+ */
+
+export * from "./SplashScreen"
diff --git a/harmony/splash_screen/src/main/module.json5 b/harmony/splash_screen/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1c7200283bd485569ab6a407347216321371f3b0
--- /dev/null
+++ b/harmony/splash_screen/src/main/module.json5
@@ -0,0 +1,7 @@
+{
+ "module": {
+ "name": "splash_screen",
+ type: 'har',
+ deviceTypes: ['default']
+ }
+}
\ No newline at end of file
diff --git a/harmony/splash_screen/ts.ts b/harmony/splash_screen/ts.ts
new file mode 100644
index 0000000000000000000000000000000000000000..fdf018dcd86d241e94ece5409e2412673bcf7ccd
--- /dev/null
+++ b/harmony/splash_screen/ts.ts
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+
+export * from "./src/main/ets/SplashScreenPackage"
+export * from "./src/main/ets/SplashScreen"
\ No newline at end of file
diff --git a/index.d.ts b/index.d.ts
index 70f23d2f30d75b9ac85f6d8dd058823843d26ae7..9d742af23f7452a4f36eda6bc2a8b8dfe0436383 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -1,6 +1,39 @@
+/**
+ * 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 { Platform } from "react-native";
+
declare module "react-native-splash-screen" {
- export default class SplashScreen {
+ class SplashScreenCommon {
static hide(): void;
static show(): void;
}
+
+ class SplashScreenHarmony {
+ hide(): void;
+ show(): void;
+ }
+
+ export default class SplashScreen extents ((Platform.OS === 'ios' || Platform === 'android') ? SplashScreenCommon : SplashScreenHarmony) {
+
+ }
}
diff --git a/index.js b/index.js
index c06993fd24c191e4a3890857746671860607277d..b767ee08b06823160570bebf14889ee09e649074 100755
--- a/index.js
+++ b/index.js
@@ -1,3 +1,25 @@
+/**
+ * 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.
+ */
+
/**
* SplashScreen
* 启动屏
@@ -9,6 +31,6 @@
*/
'use strict';
-import { NativeModules } from 'react-native';
-export default NativeModules.SplashScreen;
+import NativeModules from './src/RNSplashScreenModule';
+export default NativeModules;
diff --git a/package.json b/package.json
index be143cd7f8e56cb5230ac8bac573601f33448bf9..353648604167e5e564b3c296f50d88a510f4e93a 100644
--- a/package.json
+++ b/package.json
@@ -1,14 +1,23 @@
{
- "name": "react-native-splash-screen",
+ "name": "@react-native-ohos/react-native-splash-screen",
"version": "3.3.0",
"description": "A splash screen for react-native, hide when application loaded ,it works on iOS and Android.",
+ "harmony": {
+ "alias": "react-native-splash-screen"
+ },
+ "overrides": {
+ },
+ "dependencies": {
+ "react-native-splash-screen": "3.3.0"
+ },
"main": "index.js",
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-splash-screen --cpp-output-path ./harmony/splash_screen/src/main/cpp/generated --ets-output-path ./harmony/splash_screen/src/main/ets/generated --turbo-modules-spec-paths ./src/RNSplashScreenModule.ts"
},
"repository": {
"type": "git",
- "url": "git+https://github.com/crazycodeboy/react-native-splash-screen.git"
+ "url": "git+https://gitee.com/openharmony-sig/rntpc_react-native-splash-screen.git"
},
"keywords": [
"react-native",
@@ -25,10 +34,13 @@
"author": "crazycodeboy",
"license": "MIT",
"bugs": {
- "url": "https://github.com/crazycodeboy/react-native-splash-screen/issues"
+ "url": "https://gitee.com/openharmony-sig/rntpc_react-native-splash-screen/issues"
+ },
+ "devDependencies": {
+ "react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
},
"peerDependencies": {
"react-native": ">=0.57.0"
},
- "homepage": "https://github.com/crazycodeboy/react-native-splash-screen#readme"
+ "homepage": "https://gitee.com/openharmony-sig/rntpc_react-native-splash-screen#readme"
}
\ No newline at end of file
diff --git a/src/RNSplashScreenModule.ts b/src/RNSplashScreenModule.ts
new file mode 100644
index 0000000000000000000000000000000000000000..466810cf84b4cb25495e02c2a25e0bd670f5ae3c
--- /dev/null
+++ b/src/RNSplashScreenModule.ts
@@ -0,0 +1,30 @@
+/**
+ * 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 { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport'
+import { TurboModuleRegistry } from 'react-native';
+
+export interface Spec extends TurboModule {
+ hide: () => void;
+}
+
+export default TurboModuleRegistry.getEnforcing('SplashScreen');
\ No newline at end of file