@hxa-rn/react-native-splash-view 0.0.21-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +237 -0
  3. package/dist/commonjs/index.js +16 -0
  4. package/dist/commonjs/index.js.map +1 -0
  5. package/dist/commonjs/specs/v1/NativeSplashView.js +9 -0
  6. package/dist/commonjs/specs/v1/NativeSplashView.js.map +1 -0
  7. package/dist/module/index.js +8 -0
  8. package/dist/module/index.js.map +1 -0
  9. package/dist/module/specs/v1/NativeSplashView.js +3 -0
  10. package/dist/module/specs/v1/NativeSplashView.js.map +1 -0
  11. package/dist/typescript/index.d.ts +2 -0
  12. package/dist/typescript/specs/v1/NativeSplashView.d.ts +7 -0
  13. package/harmony/splash_view/LICENSE +21 -0
  14. package/harmony/splash_view/NOTICE +33 -0
  15. package/harmony/splash_view/OAT.xml +38 -0
  16. package/harmony/splash_view/build-profile.json5 +16 -0
  17. package/harmony/splash_view/hvigorfile.ts +2 -0
  18. package/harmony/splash_view/index.ets +3 -0
  19. package/harmony/splash_view/oh-package.json5 +14 -0
  20. package/harmony/splash_view/src/main/cpp/CMakeLists.txt +15 -0
  21. package/harmony/splash_view/src/main/cpp/SplashViewPackage.h +13 -0
  22. package/harmony/splash_view/src/main/cpp/generated/RNOH/generated/BaseSplashViewPackage.h +72 -0
  23. package/harmony/splash_view/src/main/cpp/generated/RNOH/generated/dummy.cpp +2 -0
  24. package/harmony/splash_view/src/main/cpp/generated/RNOH/generated/turbo_modules/SplashView.cpp +17 -0
  25. package/harmony/splash_view/src/main/cpp/generated/RNOH/generated/turbo_modules/SplashView.h +16 -0
  26. package/harmony/splash_view/src/main/cpp/generated/react/renderer/components/splash_view/ComponentDescriptors.h +24 -0
  27. package/harmony/splash_view/src/main/cpp/generated/react/renderer/components/splash_view/EventEmitters.cpp +16 -0
  28. package/harmony/splash_view/src/main/cpp/generated/react/renderer/components/splash_view/EventEmitters.h +17 -0
  29. package/harmony/splash_view/src/main/cpp/generated/react/renderer/components/splash_view/Props.cpp +19 -0
  30. package/harmony/splash_view/src/main/cpp/generated/react/renderer/components/splash_view/Props.h +18 -0
  31. package/harmony/splash_view/src/main/cpp/generated/react/renderer/components/splash_view/ShadowNodes.cpp +17 -0
  32. package/harmony/splash_view/src/main/cpp/generated/react/renderer/components/splash_view/ShadowNodes.h +23 -0
  33. package/harmony/splash_view/src/main/cpp/generated/react/renderer/components/splash_view/States.cpp +16 -0
  34. package/harmony/splash_view/src/main/cpp/generated/react/renderer/components/splash_view/States.h +19 -0
  35. package/harmony/splash_view/src/main/ets/Logger.ts +26 -0
  36. package/harmony/splash_view/src/main/ets/SplashViewContent.ets +64 -0
  37. package/harmony/splash_view/src/main/ets/SplashViewTurboModule.ts +156 -0
  38. package/harmony/splash_view/src/main/ets/SplashViewTurboModulesFactory.ets +18 -0
  39. package/harmony/splash_view/src/main/ets/generated/index.ets +5 -0
  40. package/harmony/splash_view/src/main/ets/generated/ts.ts +5 -0
  41. package/harmony/splash_view/src/main/ets/generated/turboModules/SplashView.ts +16 -0
  42. package/harmony/splash_view/src/main/ets/generated/turboModules/ts.ts +5 -0
  43. package/harmony/splash_view/src/main/module.json5 +13 -0
  44. package/harmony/splash_view/src/main/resources/base/element/string.json +8 -0
  45. package/harmony/splash_view/src/main/resources/en_US/element/string.json +8 -0
  46. package/harmony/splash_view/src/main/resources/zh_CN/element/string.json +8 -0
  47. package/harmony/splash_view.har +0 -0
  48. package/package.json +72 -0
  49. package/src/index.tsx +8 -0
  50. package/src/specs/v1/.gitkeep +1 -0
  51. package/src/specs/v1/NativeSplashView.ts +9 -0
  52. package/src/specs/v2/.gitkeep +1 -0
@@ -0,0 +1,17 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include "Props.h"
12
+ #include <react/renderer/core/PropsParserContext.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -0,0 +1,18 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+
17
+
18
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeCpp.js
9
+ */
10
+
11
+ #include "ShadowNodes.h"
12
+
13
+ namespace facebook::react {
14
+
15
+
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,23 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "EventEmitters.h"
14
+ #include "Props.h"
15
+ #include "States.h"
16
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
+ #include <jsi/jsi.h>
18
+
19
+ namespace facebook::react {
20
+
21
+
22
+
23
+ } // namespace facebook::react
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateStateCpp.js
9
+ */
10
+ #include "States.h"
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateStateH.js
8
+ */
9
+ #pragma once
10
+
11
+ #ifdef ANDROID
12
+ #include <folly/dynamic.h>
13
+ #endif
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -0,0 +1,26 @@
1
+ import { hilog } from '@kit.PerformanceAnalysisKit';
2
+
3
+ /**
4
+ * 统一日志封装(RNOH 规范:禁止 console.log,统一使用 hilog)。
5
+ * 所有模块关键路径(子窗口创建/隐藏、close 参数解析、异常)经此处输出。
6
+ */
7
+ const DOMAIN: number = 0x0007;
8
+ const TAG: string = 'SplashView';
9
+
10
+ export class Logger {
11
+ static info(message: string): void {
12
+ hilog.info(DOMAIN, TAG, '%{public}s', message);
13
+ }
14
+
15
+ static debug(message: string): void {
16
+ hilog.debug(DOMAIN, TAG, '%{public}s', message);
17
+ }
18
+
19
+ static warn(message: string): void {
20
+ hilog.warn(DOMAIN, TAG, '%{public}s', message);
21
+ }
22
+
23
+ static error(message: string): void {
24
+ hilog.error(DOMAIN, TAG, '%{public}s', message);
25
+ }
26
+ }
@@ -0,0 +1,64 @@
1
+ import { SplashViewTurboModule } from './SplashViewTurboModule';
2
+ import { Logger } from './Logger';
3
+
4
+ /**
5
+ * 启动页内容槽组件(宿主 SplashViewPage 中嵌入使用)。
6
+ *
7
+ * - 内容槽:@BuilderParam contentBuilder 接收宿主闪屏内容(品牌图/背景等),
8
+ * 对齐 Android launch_screen 布局 / iOS LaunchScreen.storyboard 的宿主资源职责。
9
+ * - 关闭动画:aboutToAppear 注册静态 close-delegate;hideSplash() 派发到此处后,
10
+ * 在本组件自身的 UIContext(子窗口)上执行 animateTo 属性动画:
11
+ * 0.1s 延时 + 0.3s 淡出(opacity 1→0,Curve.EaseInOut)
12
+ * 动画 onFinish 回调销毁子窗口(对齐 iOS hideSplash 的 dispatch_after(0.1) + animate 0.3s)。
13
+ * - aboutToDisappear 注销 delegate(CLAUDE.md 规则 6:监听/回调必须配对清理)。
14
+ */
15
+ @Component
16
+ export struct SplashViewContent {
17
+ @State splashOpacity: number = 1;
18
+ @BuilderParam contentBuilder: () => void = this.emptyContentBuilder;
19
+
20
+ @Builder
21
+ emptyContentBuilder() {
22
+ }
23
+
24
+ aboutToAppear(): void {
25
+ Logger.info('SplashViewContent aboutToAppear: register close delegate');
26
+ SplashViewTurboModule.registerCloseDelegate(() => {
27
+ this.runCloseAnimation();
28
+ });
29
+ }
30
+
31
+ aboutToDisappear(): void {
32
+ Logger.info('SplashViewContent aboutToDisappear: unregister close delegate');
33
+ SplashViewTurboModule.unregisterCloseDelegate();
34
+ }
35
+
36
+ /**
37
+ * 在启动页 UIContext 上执行关闭动画(对齐 iOS hideSplash 语义:0.1s 延时 + 0.3s 淡出)。
38
+ * delay/duration 为毫秒,animateTo 统一处理(delay 先延迟,再在 duration 内完成过渡,onFinish 后销毁窗口)。
39
+ */
40
+ private runCloseAnimation(): void {
41
+ Logger.info('runCloseAnimation: delay=100, duration=300');
42
+ this.getUIContext().animateTo({
43
+ delay: 100,
44
+ duration: 300,
45
+ curve: Curve.EaseInOut,
46
+ onFinish: () => {
47
+ Logger.info('close animation finished; destroy splash window');
48
+ SplashViewTurboModule.destroySplashWindow();
49
+ }
50
+ }, () => {
51
+ this.splashOpacity = 0;
52
+ });
53
+ }
54
+
55
+ build() {
56
+ Stack() {
57
+ this.contentBuilder()
58
+ }
59
+ .width('100%')
60
+ .height('100%')
61
+ .backgroundColor(SplashViewTurboModule.backgroundColor)
62
+ .opacity(this.splashOpacity)
63
+ }
64
+ }
@@ -0,0 +1,156 @@
1
+ import { window } from '@kit.ArkUI';
2
+ import { UITurboModule, UITurboModuleContext } from '@rnoh/react-native-openharmony/ts';
3
+ import { Logger } from './Logger';
4
+ import { TM } from './generated/ts';
5
+
6
+ /**
7
+ * SplashView TurboModule(模块名 'SplashView',与 JS Spec 完全一致)。
8
+ *
9
+ * 职责:
10
+ * - 静态 showSplashView(windowStage, pageUrl):宿主 EntryAbility.onWindowStageCreate 中、
11
+ * super 之前调用,存储 windowStage 并创建全屏子窗口加载宿主启动页(原生预展示,
12
+ * 对齐 Android MainActivity.onCreate 调 SplashView.showSplashView(activity) /
13
+ * iOS AppDelegate 调 SplashView.sharedInstance showSplash 的集成方式)。
14
+ * - 实例 showSplash():JS 侧调用(无参 void),复用已存 windowStage 创建子窗口
15
+ * (已在展示则安全忽略,对齐 Android 检测 splashDialog.isShowing)。
16
+ * - 实例 hideSplash():JS 侧调用(无参 void),经静态 close-delegate 派发到启动页,
17
+ * 在启动页 UIContext 上执行 0.1s 延时 + 0.3s 淡出动画(opacity 1→0),
18
+ * onFinish 回调销毁子窗口(对齐 iOS hideSplash 的 dispatch_after(0.1) + animate 0.3s)。
19
+ *
20
+ * 架构参考:@hxa-rn/react-native-smart-splash-screen(同级已适配库)的子窗口方案 + RNOH
21
+ * UITurboModule 运行约定(方法在 UI 线程执行)。
22
+ */
23
+ export class SplashViewTurboModule extends UITurboModule implements TM.SplashView.Spec {
24
+ /** 当前展示闪屏的子窗口(未展示/已关闭时为 null) */
25
+ public static splashWindow: window.Window | null = null;
26
+ /** 宿主 EntryAbility 存储的 windowStage(JS showSplash() 复用,鸿蒙无能力从 uiAbilityContext 反向获取) */
27
+ public static windowStage: window.WindowStage | null = null;
28
+ /** 宿主启动页路径(createSubWindow 的 setUIContent 加载,宿主 EntryAbility 传入) */
29
+ public static pageUrl: string = 'pages/SplashViewPage';
30
+ /** 闪屏兜底背景色(默认白色,避免启动闪屏瞬间黑屏) */
31
+ public static backgroundColor: string = '#FFFFFF';
32
+ /** 启动页注册的关闭 delegate(UI 线程执行淡出动画) */
33
+ public static closeDelegate: (() => void) | null = null;
34
+
35
+ constructor(ctx: UITurboModuleContext) {
36
+ super(ctx);
37
+ Logger.info('SplashViewTurboModule constructed');
38
+ }
39
+
40
+ /**
41
+ * 展示闪屏(宿主 EntryAbility.onWindowStageCreate 中、super 之前调用)。
42
+ * 存储 windowStage 与 pageUrl,并立即创建全屏子窗口加载启动页。
43
+ * 与 Android MainActivity.onCreate / iOS AppDelegate 的原生预展示语义对齐。
44
+ */
45
+ public static showSplashView(windowStage: window.WindowStage, pageUrl: string): void {
46
+ SplashViewTurboModule.windowStage = windowStage;
47
+ SplashViewTurboModule.pageUrl = pageUrl;
48
+ Logger.info(`showSplashView: pageUrl=${pageUrl}`);
49
+ SplashViewTurboModule.createSubWindow();
50
+ }
51
+
52
+ /**
53
+ * JS 侧调用 showSplash():展示全屏闪屏。
54
+ * - splashWindow 非 null(已在展示,含原生预展示)→ 安全忽略
55
+ * - windowStage 为 null(宿主未集成 showSplashView)→ Logger.warn 并安全返回
56
+ * - 否则复用已存 windowStage 创建子窗口
57
+ */
58
+ public showSplash(): void {
59
+ if (SplashViewTurboModule.splashWindow !== null) {
60
+ Logger.info('showSplash: splash window already shown, ignore');
61
+ return;
62
+ }
63
+ if (SplashViewTurboModule.windowStage === null) {
64
+ Logger.warn('showSplash: windowStage not stored; call SplashView.showSplashView(windowStage, pageUrl) in EntryAbility.onWindowStageCreate first');
65
+ return;
66
+ }
67
+ Logger.info('showSplash: creating splash window');
68
+ SplashViewTurboModule.createSubWindow();
69
+ }
70
+
71
+ /**
72
+ * JS 侧调用 hideSplash():隐藏闪屏。
73
+ * - splashWindow 为 null(未展示/已关闭)→ 安全返回(对齐 Android hideSplashView 检测 null)
74
+ * - close-delegate 未注册(启动页尚未挂载,极早期调用)→ 退化为直接销毁子窗口,行为安全
75
+ * - 否则派发到启动页,执行 0.1s 延时 + 0.3s 淡出动画,onFinish 后销毁子窗口
76
+ */
77
+ public hideSplash(): void {
78
+ SplashViewTurboModule.requestHide();
79
+ }
80
+
81
+ /**
82
+ * 关闭闪屏(JS hideSplash 与原生层均可调用)。
83
+ * 经 close-delegate 在启动页 UIContext 上执行淡出动画,delegate 未就绪时直接销毁子窗口。
84
+ */
85
+ public static requestHide(): void {
86
+ if (SplashViewTurboModule.splashWindow === null) {
87
+ Logger.info('requestHide: splash window not shown, safe return');
88
+ return;
89
+ }
90
+ const delegate: (() => void) | null = SplashViewTurboModule.closeDelegate;
91
+ if (delegate !== null) {
92
+ delegate();
93
+ } else {
94
+ Logger.warn('requestHide: close delegate not registered; destroy window directly');
95
+ SplashViewTurboModule.destroySplashWindow();
96
+ }
97
+ }
98
+
99
+ /** 启动页(SplashViewContent)在 aboutToAppear 时注册关闭 delegate */
100
+ public static registerCloseDelegate(delegate: () => void): void {
101
+ SplashViewTurboModule.closeDelegate = delegate;
102
+ Logger.info('close delegate registered');
103
+ }
104
+
105
+ /** 启动页(SplashViewContent)在 aboutToDisappear 时注销关闭 delegate */
106
+ public static unregisterCloseDelegate(): void {
107
+ SplashViewTurboModule.closeDelegate = null;
108
+ Logger.info('close delegate unregistered');
109
+ }
110
+
111
+ /** 销毁闪屏子窗口并清空静态引用(动画 onFinish / 兜底路径调用) */
112
+ public static destroySplashWindow(): void {
113
+ const win: window.Window | null = SplashViewTurboModule.splashWindow;
114
+ if (win === null) {
115
+ return;
116
+ }
117
+ SplashViewTurboModule.splashWindow = null;
118
+ try {
119
+ win.destroyWindow().then(() => {
120
+ Logger.info('destroySplashWindow done');
121
+ }).catch((err: Error) => {
122
+ Logger.error(`destroyWindow rejected: ${JSON.stringify(err)}`);
123
+ });
124
+ } catch (err) {
125
+ Logger.error(`destroyWindow threw: ${JSON.stringify(err)}`);
126
+ }
127
+ }
128
+
129
+ /**
130
+ * 创建全屏子窗口加载宿主启动页。
131
+ * 流程:windowStage.createSubWindow → setWindowLayoutFullScreen(true) →
132
+ * setWindowSystemBarEnable([]) → setUIContent(pageUrl) →
133
+ * setWindowBackgroundColor('#FFFFFF') → showWindow。
134
+ * 错误码 1300002 表示重复创建(本模块以 splashWindow 非 null 守卫避免)。
135
+ */
136
+ private static async createSubWindow(): Promise<void> {
137
+ const stage: window.WindowStage | null = SplashViewTurboModule.windowStage;
138
+ if (stage === null) {
139
+ Logger.warn('createSubWindow: windowStage is null');
140
+ return;
141
+ }
142
+ try {
143
+ const subWindow: window.Window = await stage.createSubWindow('SplashViewWindow');
144
+ await subWindow.setWindowLayoutFullScreen(true);
145
+ await subWindow.setWindowSystemBarEnable([]);
146
+ await subWindow.setUIContent(SplashViewTurboModule.pageUrl);
147
+ subWindow.setWindowBackgroundColor(SplashViewTurboModule.backgroundColor);
148
+ SplashViewTurboModule.splashWindow = subWindow;
149
+ await subWindow.showWindow();
150
+ Logger.info('splash window shown');
151
+ } catch (err) {
152
+ SplashViewTurboModule.splashWindow = null;
153
+ Logger.error(`createSubWindow failed: ${JSON.stringify(err)}`);
154
+ }
155
+ }
156
+ }
@@ -0,0 +1,18 @@
1
+ import { RNOHPackage } from '@rnoh/react-native-openharmony/ets';
2
+ import type { UITurboModule, UITurboModuleContext } from '@rnoh/react-native-openharmony/ts';
3
+ import { SplashViewTurboModule } from './SplashViewTurboModule';
4
+ import { TM } from './generated/ts';
5
+
6
+ export class SplashViewPackage extends RNOHPackage {
7
+ getUITurboModuleFactoryByNameMap(): Map<string, (ctx: UITurboModuleContext) => UITurboModule | null> {
8
+ const map = new Map<string, (ctx: UITurboModuleContext) => UITurboModule | null>();
9
+ map.set(TM.SplashView.NAME, (ctx: UITurboModuleContext) => new SplashViewTurboModule(ctx));
10
+ return map;
11
+ }
12
+
13
+ override async createEagerUITurboModuleByNameMap(ctx: UITurboModuleContext): Promise<Map<string, UITurboModule>> {
14
+ const module = new SplashViewTurboModule(ctx);
15
+ return new Map()
16
+ .set(TM.SplashView.NAME, module)
17
+ }
18
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from './ts'
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * as TM from "./turboModules/ts"
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ import { Tag } from "@rnoh/react-native-openharmony/ts"
6
+
7
+ export namespace SplashView {
8
+ export const NAME = 'SplashView' as const
9
+
10
+ export interface Spec {
11
+ showSplash(): void;
12
+
13
+ hideSplash(): void;
14
+
15
+ }
16
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from "./SplashView"
@@ -0,0 +1,13 @@
1
+ {
2
+ "module": {
3
+ "name": "splash_view",
4
+ "type": "har",
5
+ "deviceTypes": [
6
+ "default",
7
+ "tablet",
8
+ "2in1"
9
+ ],
10
+ "requestPermissions": [
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "page_show",
5
+ "value": "page from npm package"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "page_show",
5
+ "value": "page from npm package"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "page_show",
5
+ "value": "page from npm package"
6
+ }
7
+ ]
8
+ }
Binary file
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@hxa-rn/react-native-splash-view",
3
+ "displayName": "@hxa-rn/react-native-splash-view",
4
+ "version": "0.0.21-beta.1",
5
+ "description": "A lightweight splash screen library for React Native.",
6
+ "main": "./dist/commonjs/index.js",
7
+ "module": "./dist/module/index.js",
8
+ "react-native": "./dist/module/index.js",
9
+ "types": "./dist/typescript/index.d.ts",
10
+ "license": "MIT",
11
+ "private": false,
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/jagnesh/react-native-splash-view.git"
15
+ },
16
+ "keywords": [
17
+ "react-native",
18
+ "harmony",
19
+ "harmonyos"
20
+ ],
21
+ "homepage": "https://github.com/jagnesh/react-native-splash-view#readme",
22
+ "publishConfig": {
23
+ "registry": "https://registry.npmjs.org/"
24
+ },
25
+ "files": [
26
+ "dist/",
27
+ "src/",
28
+ "README.md",
29
+ "LICENSE",
30
+ "harmony/"
31
+ ],
32
+ "scripts": {
33
+ "prepare": "tsc --noEmit && bob build",
34
+ "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name splash_view --cpp-output-path ./harmony/splash_view/src/main/cpp/generated --ets-output-path ./harmony/splash_view/src/main/ets/generated --turbo-modules-spec-paths ./src/specs/v1/NativeSplashView.ts"
35
+ },
36
+ "peerDependencies": {
37
+ "react-native": ">=0.72",
38
+ "react": "*"
39
+ },
40
+ "devDependencies": {
41
+ "typescript": "5.0.4",
42
+ "@react-native/typescript-config": "0.79.5",
43
+ "react": "18.2.0",
44
+ "@types/react": "18.2.79",
45
+ "react-native": "0.72.5",
46
+ "jest": "^29.6.3",
47
+ "react-native-builder-bob": "^0.18.0",
48
+ "@react-native-oh/react-native-harmony-cli": "^0.77.50",
49
+ "metro": "^0.81.0"
50
+ },
51
+ "engines": {
52
+ "node": ">=18"
53
+ },
54
+ "harmony": {
55
+ "alias": "react-native-splash-view",
56
+ "autolinking": {
57
+ "cmakeLibraryTargetName": "splash_view",
58
+ "ohPackageName": "@hxa-rn/react-native-splash-view",
59
+ "etsPackageClassName": "SplashViewPackage",
60
+ "cppPackageClassName": "SplashViewPackage"
61
+ }
62
+ },
63
+ "react-native-builder-bob": {
64
+ "source": "src",
65
+ "output": "dist",
66
+ "targets": [
67
+ "commonjs",
68
+ "module",
69
+ "typescript"
70
+ ]
71
+ }
72
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,8 @@
1
+ import SplashView from './specs/v1/NativeSplashView';
2
+
3
+ export function showSplash(): void {
4
+ return SplashView.showSplash();
5
+ }
6
+ export function hideSplash(): void {
7
+ return SplashView.hideSplash();
8
+ }
@@ -0,0 +1 @@
1
+ # This file ensures the directory is tracked by Git even if other files are removed
@@ -0,0 +1,9 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ showSplash(): void;
6
+ hideSplash(): void;
7
+ }
8
+
9
+ export default TurboModuleRegistry.getEnforcing<Spec>('SplashView');
@@ -0,0 +1 @@
1
+ # This file ensures the directory is tracked by Git