Every library you add to an Expo project comes from one of three places: React Native itself, the Expo SDK, or a third-party package. Where it comes from tells you where to look for it, and whether it ships native code tells you if it can run in Expo Go or only in a development build. Both questions are worth answering before you build a screen around the library.
Key terms
- Expo SDK: the libraries Expo provides for device and system features such as the camera, audio, calendar and contacts, picking up where React Native's core libraries end.
- React Native Directory: a searchable database of libraries built for React Native.
- Config plugin: the mechanism a library uses to apply extra native configuration to your project, listed in the
pluginsarray of the app config.
Core, Expo SDK or third party
Core components and APIs such as Text and View come from react-native, and the Expo SDK covers the device and system features beyond them. You find its libraries in Expo's API reference or with the search on docs.expo.dev. Each API reference page starts with platform compatibility tags that show which platforms and environments the library supports, and when a library requires a config plugin, its page usually explains how to use it.
For a library that neither React Native nor the Expo SDK provides, start with React Native Directory. The npm registry comes next, with a caveat: npm hosts libraries for every JavaScript environment, from Node.js to web browsers and Electron, so a package being on npm says nothing about whether it supports React Native. When a library isn't listed on React Native Directory, npx npm-home --github <package-name> opens its GitHub page so you can inspect the repository yourself.
Native code decides where it runs
Any library that is compatible with React Native works in an Expo project when you run it in a development build. A development build includes all the native code your project needs, including libraries that require changes to the android and ios native projects. Expo Go doesn't include all the native code needed to support every library, so a library that works in your development build may not work in Expo Go.
That splits libraries in two. Installing a library that needs no native code changes stays inside the usual loop of writing and running JavaScript, and nothing on the native side changes. A library that does change the native project, by providing a config plugin or by giving you steps to update the app config, requires a development build.
React Native Directory can answer the Expo Go question directly. A library that works in Expo Go carries an Expo Go tag there, and the site has a filter that lists only those libraries.
Four signs in the repository
When the directory doesn't settle it, open the library's repository and README and look for these signs:
- The library includes
androidoriosdirectories. - Its README mentions linking.
- It asks you to change
android/app/src/main/AndroidManifest.xml,ios/Podfileorios/Info.plist. - It has a config plugin.
Any one of them means the library touches the native project, so you need a development build to use it. Nothing else counts toward the checklist, including how popular the package is, where it is published and which language its JavaScript is written in.
Vetting a QR scanner for a check-in screen
Say you need a QR code scanner for an event check-in screen and you find a candidate on npm. Being on npm proves nothing, so you look it up on React Native Directory first. If it has no Expo Go tag, you open its README and find a setup step that adds a camera usage description to ios/Info.plist. That is sign 3, so the scanner needs a development build and you can't test the check-in flow in Expo Go.
If the library ships a config plugin, npx expo install takes care of one step for you. After installing a package that has a valid config plugin, it adds the package to the plugins array of your app config, unless it's already listed, and logs "Added config plugin". The plugins key lists the config plugins that add functionality to your project.