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.