@oh-expo/expo-haptics
v55.0.14-harmony.1
Published
expo-haptics 的 HarmonyOS 适配包(ExpoModule 原生模块,expo-modules-core 体系)
Maintainers
Readme
@oh-expo/expo-haptics
让 expo-haptics(Expo 触感反馈)在 HarmonyOS / OpenHarmony 上运行的适配包。
通过 expo-modules-core 体系提供 ExpoHapticsModule 原生模块(notificationAsync / impactAsync / selectionAsync)。
支持基线
| 项 | 值 |
| --- | --- |
| 适配目标 | [email protected] |
| 运行时底座 | @expo-harmony/[email protected](本地 HAR) |
| 鸿蒙 SDK | API 26(SDK 26.0.0 锚定;预设/模式按 API 12/18 分级降级) |
| 权限 | ohos.permission.VIBRATE(module.json5 已声明) |
快速开始(宿主接入)
- 安装(npm):
npm install @oh-expo/expo-haptics(peer 自动带 expo-haptics 原包与 expo-modules-core); - 从
node_modules/@oh-expo/expo-haptics/local-hars/拷贝expo_haptics.har到宿主harmony/local-hars/,宿主oh-package.json5依赖"@oh-expo/expo-haptics": "file:local-hars/expo_haptics.har"(ohpm 公共源无 @oh-expo scope, 本地 HAR 必须用相对路径); - expo-modules 体系模块经 expo-modules-core 运行时注册(无需改 RNOHPackagesFactory);
- JS 侧直接
import * as Haptics from 'expo-haptics'(对外契约由原包提供)。
构建与校验
pnpm har:prepare # hvigorw assembleHar → local-hars/expo_haptics.har
pnpm har:prepack # 发布前校验(必需文件 / scope / -harmony.N 版本 / HAR 产物)状态与来源
- ⚠️ 实现已落盘(参照 renbaoshuo/expo-harmony 的 expo-haptics 适配,MIT,来源致谢); 编译与宿主接入验证状态见 expo-harmony 主仓 [acceptance/ledger.md](S4 前置门口径)。
- 适配细节与接口规格:expo-harmony 主仓
docs/adaptations/expo-haptics.md。
