Every app is made up of some combination of React Native, Expo SDK, and third party libraries. It's important to understand how to use the libraries from each of these sources, and how to determine whether a third-party library will work in your project or not.
React Native provides a set of built-in primitives that most developers will need in their app. These include components such as ActivityIndicator, TextInput, Text, ScrollView, and View. These are listed in the Core Components and APIs page of the React Native documentation.
To use a React Native library in your project, import it from the react-native package in your code:
If you initialized your app using @react-native-community/cli and you don't have the expo package installed in it yet, please refer to the guide for using the Expo SDK in existing apps.
The Expo SDK picks up where the React Native core libraries end - it provides access to a lot of useful device and system functionality like audio, barcode scanning, camera, calendar, contacts, video, and so on. It also adds other powerful libraries like updates, maps, OAuth authentication tools, and more.
To use a library from the Expo SDK, find the one you are looking for in the API Reference or through the documentation Search bar.
At the top of the page you will see a description of the library and a platform compatibility table. It tells you which platforms and environments the library is compatible with. It looks like this:
After the platform compatibility table, there will be an Installation section, with instructions that look like this:
→ expo install expo-device
Next, under the API section the reference page will tell you how to import the library in your code:
This section also lists all of the types, functions, and classes available. If you use TypeScript, you can see this information in your TypeScript-compatible code editor (such as Visual Studio Code) with autocompletion.
React Native Directory is a searchable database of libraries built specifically for React Native. If the library that you are looking for is not provided by React Native or Expo then this is the best place to look first when trying to find a library for your app.
Is it built specifically for Node.js, the web, electron, or another platform? If so, it may not work here. You can go ahead and try it in a new project to be sure! Run npx create-expo-app --template bare-minimum and add the library to the new project and try to use it. This is a great way to experiment with a library before including it in your project in all circumstances.