Getting Started
Automatic Installation
We recommend starting a new thirdweb React Native project using our CLI, which sets up everything automatically for you.
In your CLI, run:
or clone the expo-starter repo using git.
Manual Installation
To manually install the React Native SDK, you'll need to install the @thirdweb/react-native-adapter package from npm on top of the thirdweb package.
Install the packages
Using your favorite package manager or expo, install all the require dependencies
Since react native requires installing native dependencies directly, you also have to install these required peer dependencies:
Here's an explanation of each peer dependency and why its needed:
Edit your `metro.config.js`
If you don't already have a
metro.config.file.jsin your project, you can create one by running:Then, you need to add 2 properties to the metro resolver:
unstable_enablePackageExportsandunstable_conditionNames. This is to tell metro to resolve namedexportsproperly.Import `@thirdweb-dev/react-native-adapter`
Without
expo-routerSimply import the package in the entrypoint of your app before any other import. This will polyfill all the required functionality needed.
With
expo-routerIf you're using
expo-router, you need to polyfill before the router entry:1. create a
index.jsCreate an
index.jsfile at the root of the repo. This will be the new entrypoint to your app, ensuring the polyfills happen before any routing.2. Change your main entrypoint in
package.jsonNow you can replace
expo-router/entrywith./index.jsas your main entrypoint.Run the development build
You can run the development build using the Expo CLI, note that this needs to use the 'development build' option and not Expo Go.
Examples:
Use the `thirdweb` package normally
Once all the setup above is all done, you can use the most of functionality in the
thirdwebpackage out of the box, without having to do any react native specific code.This means that you can follow all the React documentation and expect it all to be exactly the same.
Examples:
