@react-native-ohos/ting 1.2.3-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 -0
- package/README.OpenSource +11 -0
- package/README.md +14 -0
- package/harmony/ting/build-profile.json5 +9 -0
- package/harmony/ting/hvigorfile.ts +2 -0
- package/harmony/ting/index.ets +3 -0
- package/harmony/ting/obfuscation-rules.txt +18 -0
- package/harmony/ting/oh-package.json5 +12 -0
- package/harmony/ting/src/main/cpp/CMakeLists.txt +9 -0
- package/harmony/ting/src/main/cpp/TingPackage.h +36 -0
- package/harmony/ting/src/main/cpp/generated/RNOH/generated/BaseTingPackage.h +65 -0
- package/harmony/ting/src/main/cpp/generated/RNOH/generated/turbo_modules/Ting.cpp +19 -0
- package/harmony/ting/src/main/cpp/generated/RNOH/generated/turbo_modules/Ting.h +16 -0
- package/harmony/ting/src/main/ets/Logger.ets +64 -0
- package/harmony/ting/src/main/ets/TingPackage.ets +47 -0
- package/harmony/ting/src/main/ets/TingTurboModule.ets +514 -0
- package/harmony/ting/src/main/ets/Type.ets +133 -0
- package/harmony/ting/src/main/ets/generated/components/ts.ts +5 -0
- package/harmony/ting/src/main/ets/generated/index.ets +5 -0
- package/harmony/ting/src/main/ets/generated/ts.ts +6 -0
- package/harmony/ting/src/main/ets/generated/turboModules/Ting.ts +20 -0
- package/harmony/ting/src/main/ets/generated/turboModules/ts.ts +5 -0
- package/harmony/ting/src/main/module.json5 +7 -0
- package/harmony/ting/src/main/resources/base/element/color.json +8 -0
- package/harmony/ting/src/main/resources/base/element/string.json +16 -0
- package/harmony/ting/src/main/resources/base/profile/backup_config.json +3 -0
- package/harmony/ting/src/main/resources/base/profile/main_pages.json +5 -0
- package/harmony/ting/src/main/resources/en_US/element/string.json +16 -0
- package/harmony/ting/src/main/resources/zh_CN/element/string.json +16 -0
- package/harmony/ting/ts.ets +7 -0
- package/harmony/ting.har +0 -0
- package/lib/commonjs/NativeTing.js +14 -0
- package/lib/commonjs/NativeTing.js.map +1 -0
- package/lib/commonjs/Type.js +2 -0
- package/lib/commonjs/Type.js.map +1 -0
- package/lib/commonjs/index.js +73 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeTing.js +9 -0
- package/lib/module/NativeTing.js.map +1 -0
- package/lib/module/Type.js +2 -0
- package/lib/module/Type.js.map +1 -0
- package/lib/module/index.js +47 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/NativeTing.d.ts +10 -0
- package/lib/typescript/NativeTing.d.ts.map +1 -0
- package/lib/typescript/Type.d.ts +98 -0
- package/lib/typescript/Type.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +10 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +165 -0
- package/src/NativeTing.ts +17 -0
- package/src/Type.ts +108 -0
- package/src/index.tsx +64 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 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
|
+
export * from './src/main/ets/TingPackage';
|
|
7
|
+
export * from "./src/main/ets/TingTurboModule";
|
package/harmony/ting.har
ADDED
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
10
|
+
* Use of this source code is governed by a MIT license that can be
|
|
11
|
+
* found in the LICENSE file.
|
|
12
|
+
*/
|
|
13
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('Ting');
|
|
14
|
+
//# sourceMappingURL=NativeTing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeTing.ts"],"mappings":";;;;;;AAOA,IAAAA,YAAA,GAAAC,OAAA;AAPA;AACA;AACA;AACA;AACA;AAJA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAgBeC,gCAAmB,CAACC,YAAY,CAAO,MAAM,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"..\\..\\src","sources":["Type.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
toast: true,
|
|
8
|
+
alert: true,
|
|
9
|
+
dismissAlert: true,
|
|
10
|
+
setup: true
|
|
11
|
+
};
|
|
12
|
+
exports.alert = alert;
|
|
13
|
+
exports.dismissAlert = dismissAlert;
|
|
14
|
+
exports.setup = setup;
|
|
15
|
+
exports.toast = toast;
|
|
16
|
+
var _reactNative = require("react-native");
|
|
17
|
+
var _Type = require("./Type");
|
|
18
|
+
Object.keys(_Type).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
21
|
+
if (key in exports && exports[key] === _Type[key]) return;
|
|
22
|
+
Object.defineProperty(exports, key, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return _Type[key];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
/*
|
|
30
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
31
|
+
* Use of this source code is governed by a MIT license that can be
|
|
32
|
+
* found in the LICENSE file.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const LINKING_ERROR = `The package 'ting' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
36
|
+
ios: "- You have run 'pod install'\n",
|
|
37
|
+
default: ''
|
|
38
|
+
}) + '- You rebuilt the app after installing the package\n';
|
|
39
|
+
|
|
40
|
+
// @ts-expect-error
|
|
41
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
42
|
+
const TingModule = isTurboModuleEnabled ? require('./NativeTing').default : _reactNative.NativeModules.Ting;
|
|
43
|
+
const Ting = TingModule ? TingModule : new Proxy({}, {
|
|
44
|
+
get() {
|
|
45
|
+
throw new Error(LINKING_ERROR);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const convertIconFile = options => {
|
|
49
|
+
var _options$icon;
|
|
50
|
+
const iconURI = options === null || options === void 0 || (_options$icon = options.icon) === null || _options$icon === void 0 ? void 0 : _options$icon.uri;
|
|
51
|
+
if (options !== null && options !== void 0 && options.icon) {
|
|
52
|
+
if (typeof iconURI === 'number') {
|
|
53
|
+
options.icon.uri = _reactNative.Image.resolveAssetSource(iconURI).uri;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
function toast(options) {
|
|
58
|
+
convertIconFile(options);
|
|
59
|
+
Ting.toast(options);
|
|
60
|
+
}
|
|
61
|
+
function alert(options) {
|
|
62
|
+
convertIconFile(options);
|
|
63
|
+
Ting.alert(options);
|
|
64
|
+
}
|
|
65
|
+
function dismissAlert() {
|
|
66
|
+
Ting.dismissAlert();
|
|
67
|
+
}
|
|
68
|
+
function setup(options) {
|
|
69
|
+
convertIconFile(options === null || options === void 0 ? void 0 : options.alert);
|
|
70
|
+
convertIconFile(options === null || options === void 0 ? void 0 : options.toast);
|
|
71
|
+
return Ting.setup(options);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_Type","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","LINKING_ERROR","Platform","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","TingModule","NativeModules","Ting","Proxy","Error","convertIconFile","options","_options$icon","iconURI","icon","uri","Image","resolveAssetSource","toast","alert","dismissAlert","setup"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AARA;AACA;AACA;AACA;AACA;;AAMA,MAAMS,aAAa,GACjB,+DAA+D,GAC/DC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD;;AAExD;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,UAAU,GAAGH,oBAAoB,GACnCnB,OAAO,CAAC,cAAc,CAAC,CAACkB,OAAO,GAC/BK,0BAAa,CAACC,IAAI;AAEtB,MAAMA,IAAI,GAAGF,UAAU,GACnBA,UAAU,GACV,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEZ,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIa,KAAK,CAACZ,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMa,eAAe,GAAIC,OAAoC,IAAW;EAAA,IAAAC,aAAA;EACtE,MAAMC,OAAO,GAAGF,OAAO,aAAPA,OAAO,gBAAAC,aAAA,GAAPD,OAAO,CAAEG,IAAI,cAAAF,aAAA,uBAAbA,aAAA,CAAeG,GAAG;EAClC,IAAIJ,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEG,IAAI,EAAE;IACjB,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;MAC/BF,OAAO,CAACG,IAAI,CAACC,GAAG,GAAGC,kBAAK,CAACC,kBAAkB,CAACJ,OAAO,CAAC,CAACE,GAAG;IAC1D;EACF;AACF,CAAC;AAEM,SAASG,KAAKA,CAACP,OAAqB,EAAQ;EACjDD,eAAe,CAACC,OAAO,CAAC;EACxBJ,IAAI,CAACW,KAAK,CAACP,OAAO,CAAC;AACrB;AAEO,SAASQ,KAAKA,CAACR,OAAqB,EAAQ;EACjDD,eAAe,CAACC,OAAO,CAAC;EACxBJ,IAAI,CAACY,KAAK,CAACR,OAAO,CAAC;AACrB;AAEO,SAASS,YAAYA,CAAA,EAAS;EACnCb,IAAI,CAACa,YAAY,CAAC,CAAC;AACrB;AAEO,SAASC,KAAKA,CAACV,OAGrB,EAAQ;EACPD,eAAe,CAACC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEQ,KAAqB,CAAC;EAC/CT,eAAe,CAACC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,KAAqB,CAAC;EAC/C,OAAOX,IAAI,CAACc,KAAK,CAACV,OAAO,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 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 { TurboModuleRegistry } from 'react-native';
|
|
8
|
+
export default TurboModuleRegistry.getEnforcing('Ting');
|
|
9
|
+
//# sourceMappingURL=NativeTing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeTing.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAGA,SAASA,mBAAmB,QAAQ,cAAc;AASlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,MAAM,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"..\\..\\src","sources":["Type.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 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
|
+
export * from './Type';
|
|
9
|
+
const LINKING_ERROR = `The package 'ting' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
10
|
+
ios: "- You have run 'pod install'\n",
|
|
11
|
+
default: ''
|
|
12
|
+
}) + '- You rebuilt the app after installing the package\n';
|
|
13
|
+
|
|
14
|
+
// @ts-expect-error
|
|
15
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
16
|
+
const TingModule = isTurboModuleEnabled ? require('./NativeTing').default : NativeModules.Ting;
|
|
17
|
+
const Ting = TingModule ? TingModule : new Proxy({}, {
|
|
18
|
+
get() {
|
|
19
|
+
throw new Error(LINKING_ERROR);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const convertIconFile = options => {
|
|
23
|
+
var _options$icon;
|
|
24
|
+
const iconURI = options === null || options === void 0 || (_options$icon = options.icon) === null || _options$icon === void 0 ? void 0 : _options$icon.uri;
|
|
25
|
+
if (options !== null && options !== void 0 && options.icon) {
|
|
26
|
+
if (typeof iconURI === 'number') {
|
|
27
|
+
options.icon.uri = Image.resolveAssetSource(iconURI).uri;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export function toast(options) {
|
|
32
|
+
convertIconFile(options);
|
|
33
|
+
Ting.toast(options);
|
|
34
|
+
}
|
|
35
|
+
export function alert(options) {
|
|
36
|
+
convertIconFile(options);
|
|
37
|
+
Ting.alert(options);
|
|
38
|
+
}
|
|
39
|
+
export function dismissAlert() {
|
|
40
|
+
Ting.dismissAlert();
|
|
41
|
+
}
|
|
42
|
+
export function setup(options) {
|
|
43
|
+
convertIconFile(options === null || options === void 0 ? void 0 : options.alert);
|
|
44
|
+
convertIconFile(options === null || options === void 0 ? void 0 : options.toast);
|
|
45
|
+
return Ting.setup(options);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","Image","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","TingModule","require","Ting","Proxy","get","Error","convertIconFile","options","_options$icon","iconURI","icon","uri","resolveAssetSource","toast","alert","dismissAlert","setup"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,QAAQ,EAAEC,KAAK,QAAQ,cAAc;AAE7D,cAAc,QAAQ;AAEtB,MAAMC,aAAa,GACjB,+DAA+D,GAC/DF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD;;AAExD;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,UAAU,GAAGH,oBAAoB,GACnCI,OAAO,CAAC,cAAc,CAAC,CAACL,OAAO,GAC/BN,aAAa,CAACY,IAAI;AAEtB,MAAMA,IAAI,GAAGF,UAAU,GACnBA,UAAU,GACV,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACZ,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMa,eAAe,GAAIC,OAAoC,IAAW;EAAA,IAAAC,aAAA;EACtE,MAAMC,OAAO,GAAGF,OAAO,aAAPA,OAAO,gBAAAC,aAAA,GAAPD,OAAO,CAAEG,IAAI,cAAAF,aAAA,uBAAbA,aAAA,CAAeG,GAAG;EAClC,IAAIJ,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEG,IAAI,EAAE;IACjB,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;MAC/BF,OAAO,CAACG,IAAI,CAACC,GAAG,GAAGnB,KAAK,CAACoB,kBAAkB,CAACH,OAAO,CAAC,CAACE,GAAG;IAC1D;EACF;AACF,CAAC;AAED,OAAO,SAASE,KAAKA,CAACN,OAAqB,EAAQ;EACjDD,eAAe,CAACC,OAAO,CAAC;EACxBL,IAAI,CAACW,KAAK,CAACN,OAAO,CAAC;AACrB;AAEA,OAAO,SAASO,KAAKA,CAACP,OAAqB,EAAQ;EACjDD,eAAe,CAACC,OAAO,CAAC;EACxBL,IAAI,CAACY,KAAK,CAACP,OAAO,CAAC;AACrB;AAEA,OAAO,SAASQ,YAAYA,CAAA,EAAS;EACnCb,IAAI,CAACa,YAAY,CAAC,CAAC;AACrB;AAEA,OAAO,SAASC,KAAKA,CAACT,OAGrB,EAAQ;EACPD,eAAe,CAACC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,KAAqB,CAAC;EAC/CR,eAAe,CAACC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEM,KAAqB,CAAC;EAC/C,OAAOX,IAAI,CAACc,KAAK,CAACT,OAAO,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
toast(options: Object): void;
|
|
4
|
+
alert(options: Object): void;
|
|
5
|
+
dismissAlert(): void;
|
|
6
|
+
setup(options: Object): void;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: Spec;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=NativeTing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeTing.d.ts","sourceRoot":"","sources":["../../src/NativeTing.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,IAAI,IAAI,CAAC;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;;AAED,wBAA8D"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export interface Icon {
|
|
2
|
+
size?: number;
|
|
3
|
+
uri?: string | number;
|
|
4
|
+
tintColor?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ToastOptions {
|
|
7
|
+
title?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
titleColor?: string;
|
|
10
|
+
messageColor?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Defaults to `done`.
|
|
13
|
+
*/
|
|
14
|
+
preset?: 'done' | 'error' | 'none' | 'spinner';
|
|
15
|
+
/**
|
|
16
|
+
* Duration in seconds.
|
|
17
|
+
*/
|
|
18
|
+
duration?: number;
|
|
19
|
+
haptic?: 'success' | 'warning' | 'error' | 'none';
|
|
20
|
+
/**
|
|
21
|
+
* Defaults to `true`.
|
|
22
|
+
*/
|
|
23
|
+
shouldDismissByDrag?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Change the presentation side.
|
|
26
|
+
* Defaults to `top`.
|
|
27
|
+
*/
|
|
28
|
+
position?: 'top' | 'bottom';
|
|
29
|
+
/**
|
|
30
|
+
* backgroundColor for toastView
|
|
31
|
+
* Defaults to `null`.
|
|
32
|
+
*/
|
|
33
|
+
backgroundColor?: string;
|
|
34
|
+
/**
|
|
35
|
+
* custom icon
|
|
36
|
+
* Defaults to `null`.
|
|
37
|
+
*/
|
|
38
|
+
icon?: Icon;
|
|
39
|
+
/**
|
|
40
|
+
* progress color for spinner preset
|
|
41
|
+
* @platform android
|
|
42
|
+
*/
|
|
43
|
+
progressColor?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface AlertOptions {
|
|
46
|
+
title?: string;
|
|
47
|
+
message?: string;
|
|
48
|
+
titleColor?: string;
|
|
49
|
+
messageColor?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Defaults to `done`.
|
|
52
|
+
*/
|
|
53
|
+
preset?: 'done' | 'error' | 'none' | 'spinner';
|
|
54
|
+
/**
|
|
55
|
+
* Duration in seconds.
|
|
56
|
+
* Defaults to 3.
|
|
57
|
+
*/
|
|
58
|
+
duration?: number;
|
|
59
|
+
/**
|
|
60
|
+
* @platform ios
|
|
61
|
+
*/
|
|
62
|
+
haptic?: 'success' | 'warning' | 'error' | 'none';
|
|
63
|
+
/**
|
|
64
|
+
* Defaults to `true`.
|
|
65
|
+
*/
|
|
66
|
+
shouldDismissByTap?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* backgroundColor for alertView
|
|
69
|
+
* Defaults to `null`.
|
|
70
|
+
*/
|
|
71
|
+
backgroundColor?: string;
|
|
72
|
+
/**
|
|
73
|
+
* borderRadius for alertView
|
|
74
|
+
* Defaults to `24`.
|
|
75
|
+
*/
|
|
76
|
+
borderRadius?: number;
|
|
77
|
+
/**
|
|
78
|
+
* blur for backdrop
|
|
79
|
+
* @platform android
|
|
80
|
+
*/
|
|
81
|
+
blurBackdrop?: number;
|
|
82
|
+
/**
|
|
83
|
+
* @platform android
|
|
84
|
+
* 0 -> 1
|
|
85
|
+
* Defaults to 0.
|
|
86
|
+
*/
|
|
87
|
+
backdropOpacity?: number;
|
|
88
|
+
/**
|
|
89
|
+
* custom icon
|
|
90
|
+
*/
|
|
91
|
+
icon?: Icon;
|
|
92
|
+
/**
|
|
93
|
+
* progress color for spinner preset
|
|
94
|
+
* @platform android
|
|
95
|
+
*/
|
|
96
|
+
progressColor?: string;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=Type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Type.d.ts","sourceRoot":"","sources":["../../src/Type.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,IAAI;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAClD;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC5B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAClD;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AlertOptions, ToastOptions } from './Type';
|
|
2
|
+
export * from './Type';
|
|
3
|
+
export declare function toast(options: ToastOptions): void;
|
|
4
|
+
export declare function alert(options: AlertOptions): void;
|
|
5
|
+
export declare function dismissAlert(): void;
|
|
6
|
+
export declare function setup(options: {
|
|
7
|
+
alert?: AlertOptions;
|
|
8
|
+
toast?: ToastOptions;
|
|
9
|
+
}): void;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACzD,cAAc,QAAQ,CAAC;AAkCvB,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAGjD;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAGjD;AAED,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE;IAC7B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,GAAG,IAAI,CAIP"}
|
package/package.json
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/ting",
|
|
3
|
+
"version": "1.2.3-rc.1",
|
|
4
|
+
"description": "test",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"harmony",
|
|
12
|
+
"src",
|
|
13
|
+
"lib",
|
|
14
|
+
"cpp",
|
|
15
|
+
"*.podspec",
|
|
16
|
+
"!lib/typescript/example",
|
|
17
|
+
"!**/__tests__",
|
|
18
|
+
"!**/__fixtures__",
|
|
19
|
+
"!**/__mocks__",
|
|
20
|
+
"!**/.*"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "jest",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
26
|
+
"prepack": "bob build",
|
|
27
|
+
"release": "release-it",
|
|
28
|
+
"example": "yarn --cwd example",
|
|
29
|
+
"bootstrap": "yarn example && yarn install && yarn example pod",
|
|
30
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
|
|
31
|
+
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name ting --cpp-output-path ./harmony/ting/src/main/cpp/generated --ets-output-path ./harmony/ting/src/main/ets/generated --turbo-modules-spec-paths ./src --arkts-components-spec-paths ./src"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"react-native",
|
|
35
|
+
"ios",
|
|
36
|
+
"android"
|
|
37
|
+
],
|
|
38
|
+
"repository": "https://gitcode.com/openharmony-sig/rntpc_ting",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://gitcode.com/openharmony-sig/rntpc_ting/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://gitcode.com/openharmony-sig/rntpc_ting#readme",
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"registry": "https://registry.npmjs.org/",
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@evilmartians/lefthook": "^1.2.2",
|
|
50
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
51
|
+
"@react-native-community/eslint-config": "^3.0.2",
|
|
52
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
53
|
+
"@types/jest": "^28.1.2",
|
|
54
|
+
"@types/react": "~17.0.21",
|
|
55
|
+
"@types/react-native": "0.70.0",
|
|
56
|
+
"commitlint": "^17.0.2",
|
|
57
|
+
"del-cli": "^5.0.0",
|
|
58
|
+
"eslint": "^8.4.1",
|
|
59
|
+
"eslint-config-prettier": "^8.5.0",
|
|
60
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
61
|
+
"jest": "^28.1.1",
|
|
62
|
+
"pod-install": "^0.1.0",
|
|
63
|
+
"prettier": "^2.0.5",
|
|
64
|
+
"react": "18.2.0",
|
|
65
|
+
"react-native": "0.72.0",
|
|
66
|
+
"react-native-builder-bob": "^0.20.0",
|
|
67
|
+
"release-it": "^15.0.0",
|
|
68
|
+
"typescript": "^4.5.2"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@baronha/ting": "^1.2.2"
|
|
72
|
+
},
|
|
73
|
+
"resolutions": {
|
|
74
|
+
"@types/react": "17.0.21"
|
|
75
|
+
},
|
|
76
|
+
"peerDependencies": {
|
|
77
|
+
"react": "*",
|
|
78
|
+
"react-native": "*"
|
|
79
|
+
},
|
|
80
|
+
"engines": {
|
|
81
|
+
"node": ">= 16.0.0"
|
|
82
|
+
},
|
|
83
|
+
"jest": {
|
|
84
|
+
"preset": "react-native",
|
|
85
|
+
"modulePathIgnorePatterns": [
|
|
86
|
+
"<rootDir>/example/node_modules",
|
|
87
|
+
"<rootDir>/lib/"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"commitlint": {
|
|
91
|
+
"extends": [
|
|
92
|
+
"@commitlint/config-conventional"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"release-it": {
|
|
96
|
+
"git": {
|
|
97
|
+
"commitMessage": "chore: release ${version}",
|
|
98
|
+
"tagName": "v${version}"
|
|
99
|
+
},
|
|
100
|
+
"npm": {
|
|
101
|
+
"publish": true
|
|
102
|
+
},
|
|
103
|
+
"github": {
|
|
104
|
+
"release": true
|
|
105
|
+
},
|
|
106
|
+
"plugins": {
|
|
107
|
+
"@release-it/conventional-changelog": {
|
|
108
|
+
"preset": "angular"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"eslintConfig": {
|
|
113
|
+
"root": true,
|
|
114
|
+
"extends": [
|
|
115
|
+
"@react-native-community",
|
|
116
|
+
"prettier"
|
|
117
|
+
],
|
|
118
|
+
"rules": {
|
|
119
|
+
"prettier/prettier": [
|
|
120
|
+
"error",
|
|
121
|
+
{
|
|
122
|
+
"quoteProps": "consistent",
|
|
123
|
+
"singleQuote": true,
|
|
124
|
+
"tabWidth": 2,
|
|
125
|
+
"trailingComma": "es5",
|
|
126
|
+
"useTabs": false
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"eslintIgnore": [
|
|
132
|
+
"node_modules/",
|
|
133
|
+
"lib/"
|
|
134
|
+
],
|
|
135
|
+
"prettier": {
|
|
136
|
+
"quoteProps": "consistent",
|
|
137
|
+
"singleQuote": true,
|
|
138
|
+
"tabWidth": 2,
|
|
139
|
+
"trailingComma": "es5",
|
|
140
|
+
"useTabs": false
|
|
141
|
+
},
|
|
142
|
+
"react-native-builder-bob": {
|
|
143
|
+
"source": "src",
|
|
144
|
+
"output": "lib",
|
|
145
|
+
"targets": [
|
|
146
|
+
"commonjs",
|
|
147
|
+
"module",
|
|
148
|
+
[
|
|
149
|
+
"typescript",
|
|
150
|
+
{
|
|
151
|
+
"project": "tsconfig.build.json"
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
"harmony": {
|
|
157
|
+
"alias": "ting",
|
|
158
|
+
"autolinking": {
|
|
159
|
+
"etsPackageClassName":"TingPackage",
|
|
160
|
+
"cppPackageClassName":"TingPackage",
|
|
161
|
+
"cmakeLibraryTargetName": "rnoh_ting",
|
|
162
|
+
"ohPackageName": "@react-native-ohos/ting"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 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 type { TurboModule } from 'react-native';
|
|
8
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
9
|
+
|
|
10
|
+
export interface Spec extends TurboModule {
|
|
11
|
+
toast(options: Object): void;
|
|
12
|
+
alert(options: Object): void;
|
|
13
|
+
dismissAlert(): void;
|
|
14
|
+
setup(options: Object): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('Ting');
|