I'm getting this error while trying to use Realm with RN 0.29
Stack trace from chrome:
"Cannot read property 'debugHosts' of undefined"
handleException @ ExceptionsManager.js:55
handleError @ InitializeJavaScriptAppEngine.js:136
reportFatalError @ error-guard.js:30
guardedLoadModule @ require.js:60
_require @ require.js:49
(anonymous function) @ require-0.js:1
executeApplicationScript @ debuggerWorker.js:18
onmessage @ debuggerWorker.js:33
The device is pointing to the index.js file in the node_modules/realm/lib/index.js
in this line:
const {debugHosts, debugPort} = NativeModules.Realm;
One thing I tried was removing all degbugHosts related stuff in the js files, and It throws Must first create RPC session with a valid host
...
Someone said that it's working on RN 0.28 but I would like to fix it instead of downgrading RN just for this module.
Steps to fix:
rnpm link realm
Add the module in the MainApplication.Java file, should look like this
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RealmReactPackage() // this
);
}
};
rebuild/clean/etc
Also, may need to add android:name=".MainApplication"
in the AndroidManifest.xml -> <application
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With