@expo-oh/expo-modules-core 3.0.30 → 3.0.31
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/README.md
CHANGED
|
@@ -1,108 +1,80 @@
|
|
|
1
1
|
# @expo-oh/expo-modules-core
|
|
2
2
|
|
|
3
|
-
HarmonyOS
|
|
3
|
+
Expo Modules 在 HarmonyOS 上的原生基础设施,连接 RNOH、JSI、原生模块与 JavaScript 公共入口。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
上游基线:`expo-modules-core@3.0.30`。本包由 [expo-harmony-cli](https://github.com/stonehill-2345/expo-harmony-cli) 项目维护,非 Expo 官方发行版本。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[鸿蒙快速开始](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/harmony/getting-started.md) · [适配源码](https://github.com/stonehill-2345/expo-harmony-cli/tree/main/packages/expo-modules-core) · [验收记录](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/releases/2026-10-09-sdk54-expo-oh-candidate.md) · [问题反馈](https://github.com/stonehill-2345/expo-harmony-cli/issues)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 安装
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
<a href="https://docs.expo.dev/modules/">
|
|
13
|
-
<img
|
|
14
|
-
src="../../.github/resources/expo-modules-core.svg"
|
|
15
|
-
alt="expo-modules-core"
|
|
16
|
-
height="64" />
|
|
17
|
-
</a>
|
|
18
|
-
</p>
|
|
11
|
+
以下命令适用于已经配置好 `@expo-oh` SDK54 依赖组合的项目。普通 Expo 项目请先阅读[鸿蒙快速开始](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/harmony/getting-started.md);仅安装此包不会自动完成 RNOH 和原生工程配置。
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
|
|
25
|
-
|
|
26
|
-
# Installation in bare React Native projects
|
|
27
|
-
|
|
28
|
-
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
|
|
29
|
-
|
|
30
|
-
### Add the package to your npm dependencies
|
|
13
|
+
```bash
|
|
14
|
+
# npm
|
|
15
|
+
npm install --save-exact expo-modules-core@npm:@expo-oh/expo-modules-core@3.0.31
|
|
31
16
|
|
|
17
|
+
# pnpm
|
|
18
|
+
pnpm add --save-exact expo-modules-core@npm:@expo-oh/expo-modules-core@3.0.31
|
|
32
19
|
```
|
|
33
|
-
npm install expo-modules-core
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Configure for iOS
|
|
37
|
-
|
|
38
|
-
Run `npx pod-install` after installing the npm package.
|
|
39
|
-
|
|
40
|
-
### Configure for Android
|
|
41
20
|
|
|
42
|
-
|
|
21
|
+
保留原依赖键:
|
|
43
22
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```ruby
|
|
53
|
-
# Podfile
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"expo-modules-core": "npm:@expo-oh/expo-modules-core@3.0.31"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
54
30
|
|
|
55
|
-
|
|
56
|
-
require File.join(File.dirname(`node --print "require.resolve('expo-modules-core/package.json')"`), "cocoapods.rb")
|
|
57
|
-
require File.join(File.dirname(`node --print "require.resolve('expo-modules-core/package.json')"`), "scripts/autolinking")
|
|
31
|
+
本包的鸿蒙适配已包含在 npm 产物中,无需额外应用本包的本地 patch。使用完整依赖组合及 overrides,保留锁文件;不要混装另一组 SDK 版本。
|
|
58
32
|
|
|
59
|
-
|
|
33
|
+
## 使用方式
|
|
60
34
|
|
|
61
|
-
|
|
62
|
-
use_unimodules!
|
|
63
|
-
config = use_native_modules!
|
|
64
|
-
use_react_native!(:path => config["reactNativePath"])
|
|
35
|
+
应用通过原包名导入;下面示例查找本组合中的 Constants 原生模块:
|
|
65
36
|
|
|
66
|
-
|
|
67
|
-
|
|
37
|
+
```ts
|
|
38
|
+
import { requireNativeModule } from "expo-modules-core";
|
|
39
|
+
const constants = requireNativeModule("ExponentConstants");
|
|
68
40
|
```
|
|
69
41
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```groovy
|
|
73
|
-
// app/build.gradle
|
|
42
|
+
业务读取应用信息优先使用 `expo-constants` 的公共 API。原生模块开发者还需要提供 Harmony C++/ArkTS 实现和模块配置,安装 Core 不会自动移植已有 Swift/Kotlin 模块。
|
|
74
43
|
|
|
75
|
-
|
|
76
|
-
apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../react.gradle")
|
|
77
|
-
apply from: new File(["node", "--print", "require.resolve('expo-updates/package.json')"].execute(null, rootDir).text.trim(), "../scripts/create-manifest-android.gradle")
|
|
44
|
+
## 鸿蒙支持范围
|
|
78
45
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
46
|
+
| 能力 | HarmonyOS 行为与边界 |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| 原生模块与事件 | 实现运行时级注册、查找、EventEmitter 和订阅 |
|
|
49
|
+
| JSI 基础对象 | 包含 NativeModule、SharedObject、SharedRef 及资源销毁处理 |
|
|
50
|
+
| 异步调用 | 原生任务通过 RNOH CallInvoker 完成 Promise;取消为协作式 |
|
|
51
|
+
| 原生视图 | 存在 Harmony 视图适配及 Fabric 示例,不代表所有视图契约完全对齐 |
|
|
52
|
+
| 模块开发 | 不提供完整 Expo Modules DSL 或 Swift/Kotlin 到 ArkTS 的自动转换 |
|
|
53
|
+
| 支持承诺 | SDK54 模板验收不等同于全部 Core API、原生视图或生产负载验收 |
|
|
84
54
|
|
|
85
|
-
|
|
86
|
-
// settings.gradle
|
|
55
|
+
## 生成和运行原生工程
|
|
87
56
|
|
|
88
|
-
|
|
89
|
-
includeUnimodulesProjects()
|
|
57
|
+
从已配置项目根目录执行:
|
|
90
58
|
|
|
91
|
-
|
|
92
|
-
|
|
59
|
+
```bash
|
|
60
|
+
npx expo prebuild --platform harmony
|
|
61
|
+
npx expo run:harmony
|
|
93
62
|
```
|
|
94
63
|
|
|
95
|
-
|
|
64
|
+
日常开发启动 Metro:`npx expo start`。安装或更新原生依赖、应用配置后,需要重新生成并构建;重启 Metro 不能替代原生构建。
|
|
96
65
|
|
|
97
|
-
|
|
66
|
+
兼容基线为 Expo SDK54、React 19.1.1、React Native 0.82.1、RNOH 0.82.30。设备、DevEco、签名要求见[快速开始](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/harmony/getting-started.md)。普通 Expo Go 不能作为本组合的鸿蒙运行容器。
|
|
98
67
|
|
|
99
|
-
|
|
100
|
-
- On Android, we use [String[]#execute](<http://docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/String[].html#execute()>) to obtain the results from the subprocess' stdout.
|
|
68
|
+
## 排查与反馈
|
|
101
69
|
|
|
102
|
-
|
|
70
|
+
- 安装后版本或功能不符:检查 package.json alias、overrides 和锁文件,使用 `npx expo install --check` 核对受管组合。
|
|
71
|
+
- 原生模块缺失或更新无效:确认使用同组合的 Core/Autolinking,重新 prebuild、构建并安装。
|
|
72
|
+
- 旧 patch 项目不会自动迁移;保留原项目,按指南新建项目后迁移业务代码,不叠加旧补丁。
|
|
103
73
|
|
|
104
|
-
|
|
74
|
+
请在[本仓库 Issues](https://github.com/stonehill-2345/expo-harmony-cli/issues) 提供包版本、RNOH/系统版本、设备类型、最小复现及日志。已记录的模板运行结果不代表全部 API 或所有设备均已验证。
|
|
105
75
|
|
|
106
|
-
|
|
76
|
+
## 上游与许可证
|
|
107
77
|
|
|
108
|
-
|
|
78
|
+
- [上游参考](https://docs.expo.dev/modules/overview/):用于通用 API 或原始包说明;HarmonyOS 支持以本文为准。
|
|
79
|
+
- 原始来源:[Expo 源码](https://github.com/expo/expo/tree/main/packages/expo-modules-core)。
|
|
80
|
+
- 保留上游许可证和来源声明,详见包内 `LICENSE`。遵循 Expo 上游 MIT 许可证。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeModulesProxy.harmony.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.harmony.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;wBAU1B,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;AAA3E,wBAA4E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ComponentType } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A drop-in replacement for `requireNativeComponent`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function requireNativeViewManager<P>(moduleName: string, viewName?: string): ComponentType<P>;
|
|
6
|
+
//# sourceMappingURL=NativeViewManagerAdapter.harmony.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeViewManagerAdapter.harmony.d.ts","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.harmony.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAkB,KAAK,aAAa,EAA4B,MAAM,OAAO,CAAC;AA4FrF;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EACxC,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAChB,aAAa,CAAC,CAAC,CAAC,CAgDlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo-oh/expo-modules-core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.31",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The core of Expo Modules architecture",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"author": "650 Industries, Inc.",
|
|
51
51
|
"license": "MIT",
|
|
52
|
-
"homepage": "https://github.com/stonehill-2345/expo-harmony-cli
|
|
52
|
+
"homepage": "https://github.com/stonehill-2345/expo-harmony-cli/blob/main/packages/expo-modules-core/README.md",
|
|
53
53
|
"jest": {
|
|
54
54
|
"preset": "expo-module-scripts"
|
|
55
55
|
},
|