Expo

https://docs.expo.dev

APIs

Environment

https://docs.expo.dev/workflow/development-mode/

  • __DEV__ is truthy in dev mode and falsy in prod mode
  • You can toggle prod mode in web UI
  • Publish is prod mode

Upgrading

  • Update the version of expo in package.json
  • npm install -g expo-cli
  • expo-cli upgrade
  • expo-cli doctor

Terminology

  • Project Types
    • Expo Go: a limited sandbox without custom native modules. Intended for testing out Expo, not for long-term projects.
    • Development Build: a build of your own app with developer tools. Supports custom native modules. Intended for production projects. Make a development build by including the expo-dev-client library in the project.
      • Built with EAS: requires an EAS account (although you can do a “local” EAS build)
      • Built with your own tools
  • Build types
    • Automatically configured by EAS (eas build:configure)
      • Development: configured as a development client (which probably means loading JS from Metro)
      • Preview: internal distribution
      • Production: non-internal distribution (including TestFlight?)
  • Commands
    • eas build [--local] - runs a build thorough EAS, on their servers by default (paid), or local (free)
    • eas build:run -p [ios|android] [--path=] - install a build on simulator/emulator, either from EAS or a specific local file
    • expo prebuild - generates native project directories but does not build
    • expo run:[ios|android] - builds and runs the development build
    • expo start [--ios|--android|--web] - starts Metro

Clear Cache

  • yarn prebuild --clean - removes node_modules/ios/android
    • rm -fr ./ios
  • yarn start -c - clears bundler cache
  • In Xcode, “Clean Build Folder Immediately” (necessary even if you remove the iOS folder, as the build cache is reused)