realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.15k stars 2.13k forks source link

Support for JavaScript / PhoneGap / React Native / Titanium / etc. #1921

Closed becomingbabyman closed 8 years ago

becomingbabyman commented 9 years ago

Do you have any plans to create a module for React Native?

timanglade commented 9 years ago

Hi @smothers we don’t support React Native at the moment. If you’re interested in helping make that happen, we are hiring :)

becomingbabyman commented 9 years ago

Thanks @timanglade, I'll certainly publish an extension if I end up going this route ;) I'm still looking into options at the moment.

The simplicity of the realm API just seems like a perfect fit with the simplicity of react native. I can't imagine many react devs wanting to use CoreData. And at the moment that's not even an option, so a realm extension could bypass that problem altogether and pick up a ton of traction in the react community.

I know it's early to think about supporting react native, but bridging just the realm write and query apis would get most devs 80% of what they need.

The biggest question would probably be how to handle models and migrations. There seems to be a lot of syntactic sugar surrounding those and I haven't found much documentation about how they work behind the scenes and could be exposed outside of xcode. Maybe that's the deal breaker.

Have you thought about it?

timanglade commented 9 years ago

Yes we have. We are working on bringing Realm to more languages & platforms, including JavaScript & React Native, but we don’t have anything we can release for that yet, sorry. I don’t have a good sense on the timeline either since we always prioritize support & bugfixes above new features & new platforms, and that introduces randomized delays in our product pipeline :laughing: We have looked into it enough to know that is it is non-trivial so it might not be worth your time to roll your own… I promise we’ll share more here as soon as we can (Since I see your email on your Github profile, we might send you a build you can try when it’s ready, if that’s OK with you?) In the meantime anyone is welcome to add a :+1: or suggestions on this Github issue.

becomingbabyman commented 9 years ago

Thanks for the clarity. I'll look out for updates and yes, I'm happy to test early builds.

juggernate commented 9 years ago

:+1:

timanglade commented 9 years ago

Awesome @smothers and sorry for the vague first response, we intentionally try to keep expectations low because we know these are very exciting additions, but unfortunately/fortunately for you, we prioritize support & bugfixes above all else, so it always takes longer than people expect for us to release those exciting brand new things.

daikini commented 9 years ago

:thumbsup:

bogdantmm92 commented 9 years ago

doefler commented 8 years ago

:+1:

NilStack commented 8 years ago

image

bleonard commented 8 years ago

I looked into this a little bit. One of the hurdles that I don't quite understand how to overcome is the assumption that the various models extend RLMObject.

A workable solution would be to define all of the models in Objective C and then somehow bridge the various methods like allObjects into JS. However, the ideal would be to define the data model itself in JS classes.

I see stuff in RLMObject like this: return (RLMObject *)RLMCreateObjectInRealmWithValue(realm, [self className], value, true);

Just using the className more or less suggests there is a way to interact with Realm just via name and not having to extend it. I assume the strategy would be to pass the schema and the class name around more. Basically, more or less implement RLMObject and RLMObjectBase in JS.

When you say it like that, it sounds like it's more or less a peer to the cocoa, swift, and java implementations. All of those must depend on some base library and add helpers to core access of the database. If that was the case, one could write the bridge like is being done for SQLite and then all RLMObject-like stuff built on top of that.

Do you have some suggestions around being able to tie in at this level or other thoughts in this area?

timanglade commented 8 years ago

Yes, we think we’ve solved a lot of that stuff so stay tuned… We’re still very interested in adding support for React Native and we’ll release something as soon as we can. We see the upvotes and we know a lot of people are building on RN now… Since there is a lot of interest I’m setting up a form so we can notify you if/when a private/public beta of Realm for React Native becomes available.

miracle2k commented 8 years ago

It says I don't have permission to access the form.

timanglade commented 8 years ago

This should be fixed now.

On Sat, Jul 11, 2015 at 9:30 AM, Michael Elsdörfer <notifications@github.com

wrote:

It says I don't have permission to access the form.

— Reply to this email directly or view it on GitHub https://github.com/realm/realm-cocoa/issues/1921#issuecomment-120637667.

pompopo commented 8 years ago

FYI: I'm trying to make Realm library for React Native. https://github.com/pompopo/PRealm Defining models in JS is possible, but currently it supports only a few types and APIs.

stefalda commented 8 years ago

👍

shlomiatar commented 8 years ago

:+1:

yelled3 commented 8 years ago

:+1:

corbt commented 8 years ago

I know this issue is in the realm-cocoa repository, but given that React Native and Realm are both cross-platform it would be beyond brilliant if any bridge were transparently cross-platform as well. I'm using Realm on Android currently and love it.

ippy04 commented 8 years ago

:+1:

patoroco commented 8 years ago

:+1:

krishpop commented 8 years ago

:+1:

shahankit commented 8 years ago

:+1:

shuchitgandhi commented 8 years ago

:+1:

jayshah123 commented 8 years ago

:+1:

timanglade commented 8 years ago

Please register on this form if you are interested in testing any eventual beta release of Realm for a JavaScript platform: http://goo.gl/forms/uWKtWSRZgd (While this issue is created on the realm-cocoa repo for historical reasons, we would try to support both iOS & Android with our JavaScript releases)

timanglade commented 8 years ago

Just wanted to give everyone on this thread a heads-up that we launched Realm React Native today!

We’re looking forward to add support for PhoneGap / Cordova / Ionic in the future — please let us know what other platforms you’d like us to support (if any) on the new realm/realm-js repo!

pompopo commented 8 years ago

:+1: