简体   繁体   English

领域-React Native和Objective C

[英]Realm - React Native and Objective C

I have a project that will be partly in react native mostly for the view layer and part objective-c for some heavy lifting. 我有一个项目,部分将在本机反应本机,主要用于视图层,另一部分是objective-c,以进行一些繁重的工作。 I would like to use Realm as a db for this and be able to access it from javascript and objective-c. 我想将Realm用作数据库,并能够从javascript和Objective-c访问它。

Wondering if anyone else has run into this and what approach did you take to handling it? 想知道是否有人遇到了这个问题,您采取了什么方法来处理呢?

What I'm leaning towards is using objective-c realm and creating a RCTBridgeModule for it so I can use it from javascript. 我要使用的是Objective-C领域,并为其创建RCTBridgeModule,以便可以从JavaScript中使用它。

From what I've been told, it's possible to run both Realm React Native and Realm Objective-C in the same codebase. 据我所知,可以在同一代码库中运行Realm React Native和Realm Objective-C。

As long as the schema definitions in the React Native code and the Objective-C code match, you should be able to read and write to the same Realm file on disk from both the React Native and Objective-C portions of your code. 只要React Native代码和Objective-C代码中的模式定义匹配,您就应该能够从代码的React Native和Objective-C部分读取和写入磁盘上的同一Realm文件。

我相信已经有一个官方的插件: https : //realm.io/docs/react-native/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM