javascriptreactjsreact-nativepackage.jsonreact-native-native-module

How to add React-Native native module setup dependencies?


I'm very beginner at react-native and I want to create a native module so I followed the official documentation for doing that and in the Native Module Setup but I get confused in the third step where he says "add your newly created module as a dependency in your package.json".

May someon clear that ambiguity and clarify what he means with an example please?


Solution

  • I solved by following this https://www.deadcoderising.com/how-to-smoothly-develop-node-modules-locally-using-npm-link/

    Assuming you used the default names using the official react native documentation and AwesomeProject and MyLibrary are on the same folder level.

    1. navigate inside AwesomeProject
    2. run "npm link ../MyLibrary/"

    And then you can proceed to the next step in the documentation, which is to call "npm install"