【问题标题】:How to create react-native android modules using native modules?如何使用原生模块创建 react-native android 模块?
【发布时间】:2018-07-21 05:03:10
【问题描述】:

我想从 react native 创建 redis 客户端,我正在阅读一些教程。

https://www.smoothterminal.com/articles/using-android-native-modules

我已经建立了它。现在我正在搜索/想知道如何将其作为服务放在 npm 上?

我想知道我的项目中有哪些重要文件以及人们如何在他们的项目中使用它

【问题讨论】:

    标签: react-native npm


    【解决方案1】:
    1. 首先,上传github项目。
    2. 在 npm 上创建一个帐户。
    3. 然后只需从控制台登录即可加载它。上传 项目到 npm。
    4. 查看Example package.json文件,这样你就可以链接项目了 在 npm 上加载,在 github 上加载。

    示例包.json

    {
      "name": "react-native-nameproject",
      "version": "0.0.1",
      "description": "",
      "repository": {
        "type": "git",
        "url": "https://github.com/user/react-native-nameproject.git"
      },
      "bugs": {
        "url": "https://github.com/user/react-native-nameproject/issues"
      },
      "homepage": "https://github.com/user/react-native-nameproject#readme",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "keywords": [
        "react-native"
      ],
      "author": "",
      "license": "",
      "peerDependencies": {}
    

    如果你把你的项目的链接放在git上,最好能帮到你。

    【讨论】:

    • 感谢您的回复。所以我需要使用相同的 gradle 设置将我的 android 项目直接上传到 npm 中吗?其中有 app.jspn 和 app.js
    • app.jspn 对你来说是什么?你能把项目加载到github上,让我看看吗?如果可以的话,更好地帮助你。 ;)
    • 好像没问题,我不明白你的问题是什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-23
    • 1970-01-01
    • 2022-11-11
    • 2019-02-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多