使用Create React Native App安装Realm [英] Installing Realm with Create React Native App

查看:157
本文介绍了使用Create React Native App安装Realm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试安装Realm时,系统要求我编辑一些为Android生成的.java文件: https://realm.io/docs/javascript/latest/#getting-help 但是,创建React Native App对用户隐藏了系统级代码.这是否意味着使用CRNA是不可能的,而我必须改用直接的React Native?

While I'm trying to install Realm, I'm asked to edit some of the generated .java files for Android: https://realm.io/docs/javascript/latest/#getting-help However, Create React Native App hides the system level code from the user. Does that mean using CRNA is impossible, and I have to switch to straight React Native?

推荐答案

create-react-native-app有其自己的构建脚本,该脚本依赖于

create-react-native-app has its own build scripts that depend on the platform specific code to be modified by Expo.

create-react-native-app的整个想法是坚持使用js.通过坚持使用js,您可以利用一些非常简洁的功能,例如通过Expo Client运行应用程序或在Web上实时开发.他们之所以这样做,是因为他们可以在任何地方提供其特定于平台的静态代码(我认为这是相当静态的).

The whole idea of create-react-native-app is to stick to js. By sticking to js, you can take advantage of some pretty neat features such as running your app through the Expo Client or live developing on the web. They can do this because they can serve their static (I think it's pretty static) platform specific code everywhere.

这意味着在使用create-react-native-app时,您不能使用任何本机代码甚至第三方本机代码模块(例如react-native-camera).

This means you can't use any native code or even third party native code modules (such as react-native-camera) while using create-react-native-app.

从文档中获取:

Standard Expo项目不支持自定义本机代码,包括 需要自定义本机组件的第三方库.在 世博项目,您只编写纯JS.世博会是这样设计的 目的,我们认为这样会更好.

Standard Expo projects don’t support custom native code, including third-party libraries which require custom native components. In an Expo project, you only write pure JS. Expo is designed this way on purpose and we think it’s better this way.

如果您想使用本机代码和create-react-native-app,expo会有一个分离过程来显示平台特定的代码.您可以在此处中查看.

If you would like to use native code and create-react-native-app, expo has a detach process that will reveal the platform specific code. You can check it out here.

这篇关于使用Create React Native App安装Realm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆