Optional Pre-Reading
Build Modes
There are two build modes in Expo/React-Native:
Continuous Native Generation (CNG, formerly "managed workflow")
Bare workflow
To get to "Bare workflow" you run npx expo prebuild
(or a command that runs the prebuild such as expo run:ios
and expo run:android
) once to generate the ios and android folders (the "Native projects"), and from that point on you are now responsible for maintaining those native projects.
Any updates you make to app.json will NOT be reflected because future runs of prebuild
will NOT overwrite your existing Native projects for fear of you losing whatever changes you could have made to those projects.
You have the option of deleting those Native projects and then you can run prebuild
generate the projects from scratch again. But then you'd have to re-apply whatever changes you made to them from outside of the Expo tooling.
The Wise Choice
The more sane option is to stick with CNG. In CNG, you do NOT have the Native projects checked into your git
repository. Instead, you let Expo generate the native project with each and every build (i.e. continuously).
In CNG, whenever you make a change to app.json
and/or add new NPMs, the next build will reflect those changes because the build will generate the native project and compile the native app.
In CNG, if you want to make changes to the Native projects then you either use existing capabilities of Expo (e.g. app.json configuration, existing Expo libraries) or you create your own Expo Native Module that leverages the Config Plugin API to direct the Expo build process on how to modify the Native project when prebuild
runs.
Knowing Where You Are At
You can determine whether you are in "bare" or CNG by running npx expo-env-info
and reviewing the last line of output. It will state either bare or managed (the latter meaning CNG).
Getting Back To CNG
If you are in Bare and want to get back to CNG, the steps are:
make sure everything is committed to your version control (
git
) repository -- if something goes wrong you can get it backdelete the ios and android folders
commit the deletions to your repository
[optional] add ios and android to the
.gitignore
file at the root of your repository[verification step]: run
npx expo-env-info
to validate that you are in managed mode, not bare.
That's it. As long as you don't have ios and android folders at the root of your repository, the build will run prebuild
and generate those folders.
Further Reading
Expo's Continuous Native Generation
Expo's CNG development workflow
Usage of the prebuild command and how to .gitignore the native projects