Realm-js: Realm is not defined (React-native + Debug JS Remotely)

Created on 29 Dec 2016  路  7Comments  路  Source: realm/realm-js

Hi!
When I turn on the Debug JS Remotely feature on my Android emulator, I get this error

err

When the Debug JS Remotely is Off, I get no errors

Android: API 17
React-native: 0.39.2
Realm: 0.15.2

T-Bug

Most helpful comment

unlink and uninstall realm 0.15.2. then install 0.15.0 realm and react native link so disappear this bug

All 7 comments

Thank you for the report. Did this error start after updating realm, or was this a new project?

I encounter the same problem. It seems that starting from 0.39.2, the navigator.product object in getContext() is always returning ReactNative no matter whether it is doing remote debug. It's returning something like Gecko in version 0.38.1

Therefore, my temporary solution is that
Go to ./node_modules/realm/lib/index.js, replacing the line in the switch statement:
realmConstructor = Realm with realmConstructor = require('./browser').default;

Argh, just as I updated the constructor detection. Thanks for the info, I will fix this!

+1 Same thing happens on iOS, after updating to RN 0.39

It's worth noting that when I downgraded my RN version to 0.38 it worked when debugging in Chrome. However, when debugging with Visual Studio Code, the same thing happens, even with React Native 0.38.

unlink and uninstall realm 0.15.2. then install 0.15.0 realm and react native link so disappear this bug

import Realm from 'realm';

Was this page helpful?
0 / 5 - 0 ratings