问题描述
当我尝试安装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-helpHowever, 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.
如果您想使用本机代码和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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!