@react-native-ohos/ting 1.2.4-rc.1 → 1.3.0-rc.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.
- package/LICENSE +20 -20
- package/README.OpenSource +10 -10
- package/README.md +14 -14
- package/harmony/ting/BuildProfile.ets +5 -5
- package/harmony/ting/build-profile.json5 +9 -9
- package/harmony/ting/hvigorfile.ts +2 -2
- package/harmony/ting/index.ets +6 -6
- package/harmony/ting/obfuscation-rules.txt +17 -17
- package/harmony/ting/oh-package.json5 +11 -11
- package/harmony/ting/src/main/cpp/CMakeLists.txt +7 -7
- package/harmony/ting/src/main/cpp/Ting.cpp +23 -23
- package/harmony/ting/src/main/cpp/Ting.h +18 -18
- package/harmony/ting/src/main/cpp/TingPackage.h +31 -31
- package/harmony/ting/src/main/ets/Logger.ets +63 -63
- package/harmony/ting/src/main/ets/TingPackage.ets +45 -45
- package/harmony/ting/src/main/ets/TingTurboModule.ets +531 -514
- package/harmony/ting/src/main/ets/Type.ets +138 -133
- package/harmony/ting/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/ting/src/main/ets/generated/index.ets +5 -5
- package/harmony/ting/src/main/ets/generated/ts.ts +6 -6
- package/harmony/ting/src/main/ets/generated/turboModules/Ting.ts +25 -25
- package/harmony/ting/src/main/ets/generated/turboModules/ts.ts +5 -5
- package/harmony/ting/src/main/module.json5 +6 -6
- package/harmony/ting/src/main/resources/base/element/color.json +7 -7
- package/harmony/ting/src/main/resources/base/element/string.json +15 -15
- package/harmony/ting/src/main/resources/base/profile/backup_config.json +2 -2
- package/harmony/ting/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/ting/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/ting/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/ting.har +0 -0
- package/lib/commonjs/NativeTing.js +4 -4
- package/lib/commonjs/NativeTing.js.map +1 -1
- package/lib/commonjs/Type.js.map +1 -1
- package/lib/commonjs/index.js +4 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeTing.js +4 -4
- package/lib/module/NativeTing.js.map +1 -1
- package/lib/module/Type.js.map +1 -1
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/package.json +158 -160
- package/src/NativeTing.ts +17 -17
- package/src/Type.ts +108 -108
- package/src/index.tsx +64 -64
package/src/index.tsx
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
-
* Use of this source code is governed by a MIT license that can be
|
|
4
|
-
* found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { NativeModules, Platform, Image } from 'react-native';
|
|
8
|
-
import type { AlertOptions, ToastOptions } from './Type';
|
|
9
|
-
export * from './Type';
|
|
10
|
-
|
|
11
|
-
const LINKING_ERROR =
|
|
12
|
-
`The package 'ting' doesn't seem to be linked. Make sure: \n\n` +
|
|
13
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
14
|
-
'- You rebuilt the app after installing the package\n'
|
|
15
|
-
|
|
16
|
-
// @ts-expect-error
|
|
17
|
-
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
18
|
-
|
|
19
|
-
const TingModule = isTurboModuleEnabled
|
|
20
|
-
? require('./NativeTing').default
|
|
21
|
-
: NativeModules.Ting;
|
|
22
|
-
|
|
23
|
-
const Ting = TingModule
|
|
24
|
-
? TingModule
|
|
25
|
-
: new Proxy(
|
|
26
|
-
{},
|
|
27
|
-
{
|
|
28
|
-
get() {
|
|
29
|
-
throw new Error(LINKING_ERROR);
|
|
30
|
-
},
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const convertIconFile = (options: ToastOptions | AlertOptions): void => {
|
|
35
|
-
const iconURI = options?.icon?.uri;
|
|
36
|
-
if (options?.icon) {
|
|
37
|
-
if (typeof iconURI === 'number') {
|
|
38
|
-
options.icon.uri = Image.resolveAssetSource(iconURI).uri;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export function toast(options: ToastOptions): void {
|
|
44
|
-
convertIconFile(options);
|
|
45
|
-
Ting.toast(options);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function alert(options: AlertOptions): void {
|
|
49
|
-
convertIconFile(options);
|
|
50
|
-
Ting.alert(options);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function dismissAlert(): void {
|
|
54
|
-
Ting.dismissAlert();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function setup(options: {
|
|
58
|
-
alert?: AlertOptions;
|
|
59
|
-
toast?: ToastOptions;
|
|
60
|
-
}): void {
|
|
61
|
-
convertIconFile(options?.alert as AlertOptions);
|
|
62
|
-
convertIconFile(options?.toast as ToastOptions);
|
|
63
|
-
return Ting.setup(options);
|
|
64
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { NativeModules, Platform, Image } from 'react-native';
|
|
8
|
+
import type { AlertOptions, ToastOptions } from './Type';
|
|
9
|
+
export * from './Type';
|
|
10
|
+
|
|
11
|
+
const LINKING_ERROR =
|
|
12
|
+
`The package 'ting' doesn't seem to be linked. Make sure: \n\n` +
|
|
13
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
14
|
+
'- You rebuilt the app after installing the package\n'
|
|
15
|
+
|
|
16
|
+
// @ts-expect-error
|
|
17
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
18
|
+
|
|
19
|
+
const TingModule = isTurboModuleEnabled
|
|
20
|
+
? require('./NativeTing').default
|
|
21
|
+
: NativeModules.Ting;
|
|
22
|
+
|
|
23
|
+
const Ting = TingModule
|
|
24
|
+
? TingModule
|
|
25
|
+
: new Proxy(
|
|
26
|
+
{},
|
|
27
|
+
{
|
|
28
|
+
get() {
|
|
29
|
+
throw new Error(LINKING_ERROR);
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const convertIconFile = (options: ToastOptions | AlertOptions): void => {
|
|
35
|
+
const iconURI = options?.icon?.uri;
|
|
36
|
+
if (options?.icon) {
|
|
37
|
+
if (typeof iconURI === 'number') {
|
|
38
|
+
options.icon.uri = Image.resolveAssetSource(iconURI).uri;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export function toast(options: ToastOptions): void {
|
|
44
|
+
convertIconFile(options);
|
|
45
|
+
Ting.toast(options);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function alert(options: AlertOptions): void {
|
|
49
|
+
convertIconFile(options);
|
|
50
|
+
Ting.alert(options);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function dismissAlert(): void {
|
|
54
|
+
Ting.dismissAlert();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function setup(options: {
|
|
58
|
+
alert?: AlertOptions;
|
|
59
|
+
toast?: ToastOptions;
|
|
60
|
+
}): void {
|
|
61
|
+
convertIconFile(options?.alert as AlertOptions);
|
|
62
|
+
convertIconFile(options?.toast as ToastOptions);
|
|
63
|
+
return Ting.setup(options);
|
|
64
|
+
}
|