When importing a react-native native module. There is an issue when importing the js from the project for example
import RNModule from 'react-native-module';
However importing RNModule using native modules works:
import { NativeModules } from 'react-native';
const { RNModule } = NativeModules;
Has anyone else experienced this?
I've already tried clearing all the recommended caches as well as rebuilding.
I've tried importing from both the project name react-native-module
and the file name rn-module
Example project: https://github.com/814k31/TestReactNativeNativeModule
(Build and run instructions in README)
This is the import that doesn't work https://github.com/814k31/TestReactNativeNativeModule/blob/master/RNApp/App.js#L13
But this one does work.
When the button is clicked it will trigger a native Android
function
and should make Hello World From RNModule
appear on the screen.