I'm trying to create a node module from my React Native App. The problem is, that the module is mostly a NativeModule. So my index.js looks like this:
import { NativeModules } from 'react-native'; export default NativeModules.MyNativeClass;
When i install my package to my node_modules (inserted local relative path to package.json) and import it to my JS file, it's always undefined. I tried to export a test object, like export default {test:'test'};
and it works. So, is it possible to export the Native Module through node_modules?
If anyone is stuck to the same issue. Just link it with
react-native link
and your native modules from your node_modules get visible.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.