realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.79k stars 576 forks source link

Missing Realm constructor #1340

Closed Hatko closed 7 years ago

Hatko commented 7 years ago

Goals

I'm trying to include realm into my existing react-native app

Expected Results

Run my project in iOS via Expo app, as before realm installation

Actual Results

I have Missing Realm constructor error.

screen shot 2017-09-24 at 14 23 47

I've tried to run ⇒ react-native link realm

output is Scanning 794 folders for symlinks in pathToProject/node_modules (8ms)

After this step problem is still here

Steps to Reproduce

1) Add realm to project 2) npm start

Code Sample

Problem reproduces for me if I have import of realm in my code import Realm from 'realm'

Version of Realm and Tooling

Hatko commented 7 years ago

I've tried to update react-native to 0.48.4

Also, I created an empty project and included Realm inside - get the same error.

cherednichenkoa commented 7 years ago

I have the same error

TGPSKI commented 7 years ago

Same here for prod users on iOS

https://github.com/realm/realm-js/issues/1230#issuecomment-332379266

kneth commented 7 years ago

We have just released 1.13.0. Please try to upgrade.

TGPSKI commented 7 years ago

@kneth Thank you so much!!!

Hatko commented 7 years ago

@kneth, unfortunately we still getting the same error. steps to reproduce are really straightforward:

1) npm install --save realm 2) run with expo xde on iPhone simulator 3) error, saying missing constructor 4) react-native link realm 5) error, saying missing constructor

can you reproduce this issue? ver in package.json: "realm": "^1.13.0",

ashwinphatak commented 7 years ago

@Hatko I see that you're using Expo. Have you detached the project?

Without detaching, Expo doesn't support custom native modules.

https://docs.expo.io/versions/latest/guides/detach.html

If you created an Expo project in XDE and you want a way to add custom native modules, this guide will explain how to use ExpoKit for that purpose.

Normally, Expo apps are written in pure JS and never “drop down” to the native iOS or Android layer. This is core to the Expo philosophy and it’s part of what makes Expo fast and powerful to use.

However, there are some cases where advanced developers need native capabilities outside of what Expo offers out-of-the-box. The most common situation is when a project requires a specific Native Module which is not supported by React Native Core or the Expo SDK.

Also see https://github.com/ashwinphatak/realmexpo/commits/master

The steps I followed to get Realm working were: 1) exp detach 2) react-native link 3) Run the app using Expo XDE

Hatko commented 7 years ago

You made it clear now, thank you! 🙂