13 Star 104 Fork 304

react-native-oh-library/usage-docs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
link-source-code.md 1.18 KB
一键复制 编辑 原始数据 按行查看 历史

2.引入原生端代码

直接链接源码情况说明

目前 DevEco Studio 不支持通过源码引入外部 module,我们推荐使用 har 包的方式引入,如需要直接链接源码,请按照以下步骤操作,将源码通过操作改成 harmony 工程的内部模块。

[!TIP] 源码位于三方库安装路径的 harmony 文件夹下。

<RN工程>/node_modules/@react-native-oh-tpl/<Package_Name>/harmony/目录下的源码<xxx>复制到harmony工程根目录下

harmony工程根目录的 build-profile.template.json5(若存在)和build-profile.json5 添加以下模块

modules:[
  ...
  {
    name: '<xxx>',
    srcPath: './<xxx>',
  }
  //提示:{
  //        name: 'safe_area',
  //        srcPath: './safe_area',
  //      } 
]

打开 entry/oh-package.json5,添加以下依赖

"dependencies": {
    "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
    "@react-native-oh-tpl/<Package_Name>": "file:../<xxx>"
    // 提示: "@react-native-oh-tpl/react-native-safe-area-context": "file:../safe_area"
  }

点击右上角的 sync 按钮

或者在终端执行:

cd entry
ohpm install
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/react-native-oh-library/usage-docs.git
git@gitee.com:react-native-oh-library/usage-docs.git
react-native-oh-library
usage-docs
usage-docs
master

搜索帮助