@oh-expo/expo-linking
v55.0.17-harmony.0
Published
expo-linking 的 HarmonyOS 适配包(ExpoModule 原生模块,expo-modules-core 体系)
Maintainers
Readme
@oh-expo/expo-linking
让 expo-linking(深链)在 HarmonyOS / OpenHarmony 上运行的适配包。
通过 expo-modules-core 体系提供 ExpoLinkingModule 原生模块(模块名 ExpoLinking:
getLinkingURL/clearInitialURL + openURL/canOpenURL/openSettings + onURLReceived 事件,
接口收口自 [email protected] 权威 d.ts)。
支持基线
| 项 | 值 |
| --- | --- |
| 适配目标 | [email protected] |
| 运行时底座 | @expo-harmony/[email protected](本地 HAR) |
| 鸿蒙 SDK | API 26(SDK 26.0.0 锚定,@kit.AbilityKit + @kit.TelephonyKit + @ohos.uri + wantConstant) |
| 权限 | 无(深链接收/打开为系统公开能力;tel/sms 依赖对应系统能力) |
实现面(接口收口 + 诚实分级)
getLinkingURL(launchUri 冷启动 / onNewWant 热更新,UIAbility 级 WeakMap 状态跨重载保持)/clearInitialURL;openURL(tel→call.makeCall、sms→ACTION_SEND_SMS、其余→openLink,返回 true)/canOpenURL(bundleManager.canOpenLink + tel/sms 能力探测)/openSettings(ACTION_APPLICATION_DETAILS_SETTINGS);onURLReceived事件(监听时广播)。- 诚实分级:
sendIntent(Android 专属)不在 harmony 侧注册;无对应系统能力时 ERR_LINKING_UNAVAILABLE。
快速开始(宿主接入)
- 安装(npm):
npm install @oh-expo/expo-linking(peer 自动带 expo-linking 原包与 expo-modules-core); - 从
node_modules/@oh-expo/expo-linking/local-hars/拷贝expo_linking.har到宿主harmony/local-hars/,宿主oh-package.json5依赖"@oh-expo/expo-linking": "file:local-hars/expo_linking.har"(ohpm 公共源无 @oh-expo scope,本地 HAR 必须用相对路径); - expo-modules 体系模块经 expo-modules-core 运行时注册(无需改 RNOHPackagesFactory);
- JS 侧直接
import * as Linking from 'expo-linking'(对外契约由原包提供)。
构建与校验
pnpm har:prepare # hvigorw assembleHar → local-hars/expo_linking.har
pnpm har:prepack # 发布前校验(必需文件 / scope / -harmony.N 版本 / HAR 产物)状态与来源
- ⚠️ 实现已落盘(接口收口自 npm 实包权威 d.ts,锚定 SDK 26 真实 API); 编译与宿主接入验证状态见 expo-harmony 主仓 [acceptance/ledger.md](S4 前置门口径)。
- 适配细节与接口规格:expo-harmony 主仓
docs/adaptations/expo-linking.md。
