Installing Realm with Create React Native App

大城市里の小女人 提交于 2019-12-12 02:22:45

问题


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?


回答1:


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

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.

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.

From the docs:

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.

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.



来源:https://stackoverflow.com/questions/43431016/installing-realm-with-create-react-native-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!