Reputation: 1155
I am writing a native module (Android) for a react-native application I am working on. I am not publishing it to npm. This will be used locally in my application. I am trying to understand how I can include the native module, which won't be in node_modules directory, in the javascript code?
Can someone please help me with this?
Thanks in advance.
Upvotes: 1
Views: 136
Reputation: 13396
If you are only going to use your module in that one app, you could simply put it in your projects android/app/ directory. Making your native module accessible to JavaScript works exactly the same: extend ReactContextBaseJavaModule
and ReactPackage
then create an instance of your package in your MainActivity
s getPackages
method.
If you want to re-use your module you could also make it a separate project and put a local path or private git repo in your package.json
Upvotes: 1