Coder Social home page Coder Social logo

Comments (8)

radex avatar radex commented on May 22, 2024 1

Closing this for now, as it's not anywhere near the top of the priorities list. If anyone wants to pick up the challange, I can give some guidance, but I warn you — it's not that simple as it seems ;)

from watermelondb.

radex avatar radex commented on May 22, 2024

What do you mean exactly? Do you want to access the database directly from native code, skipping JavaScript? What's your use case for this?

from watermelondb.

Kausta avatar Kausta commented on May 22, 2024

Sometimes we require shared objects stored between native code and javascript, and that is the reasons for wanting to access database directly from native code. I wondered whether this had direct support for such a thing.

from watermelondb.

radex avatar radex commented on May 22, 2024

Currently no.

Do you need write access, or only read access? if read-only access, then it should be fairly easy to add support for native access (essentially just expose the DatabaseDriver object that DatabaseBridge - the native module - owns).

If you need to write to the database, then that would be in conflict with Watermelon, because if you add new items to the database from native code, Watermelon has no way of knowing that it might need to re-render some components.

from watermelondb.

Kausta avatar Kausta commented on May 22, 2024

Read access is okey, but write access, if there is a way to implement it, would be much better. It is possible to do it with Realm, one can read and write to the same .realm in Android, IOS and React Native. Having this with read/write ability on native would, in our eyes, make this a solid alternative to Realm. Is there currently a reason that there cannot be a way to have writes in native api ?

from watermelondb.

radex avatar radex commented on May 22, 2024

Is there currently a reason that there cannot be a way to have writes in native api ?

Yeah, like I said:

If you need to write to the database, then that would be in conflict with Watermelon, because if you add new items to the database from native code, Watermelon has no way of knowing that it might need to re-render some components.

That makes it challenging to do, because Watermelon is asynchronous and multi-threaded. Not saying it's impossible — I've got some ideas. But that will take some time to implement.

from watermelondb.

Yarkhan avatar Yarkhan commented on May 22, 2024

Would you give directions about how to read the data from the native side?

My app consists of very long, frequently updating lists that I just can't get good performance out of it. My plan is to rewrite those screens in native Android / iOS, but keep all data writing in JS.

from watermelondb.

radex avatar radex commented on May 22, 2024

use DatabaseBridge class, and methods on that.

from watermelondb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.