Getting started with Account Kit on bare React Native
This guide assumes you already have a Bare React Native app and want to integrate Account Kit. If you are starting a project from scratch, we recommend following the Expo guide instead.
We would go through the steps to get your environment setup for using Account Kit within a Bare React Native application.
Pre-requisites
- React Native version 0.76 or later
- iOS Minumum Deployment Target: 17.0
- Hermes and Fabric must be enabled (if using expo these are on by default)
- The Signer package requires you to be on React Native’s new architecture. For information on how to enable it in your Expo project, check their documentation.
- The Signer package is incompatible with Expo Go and as a result, you’d need to use a Development Build. Check the Expo Development Builds documentation for more information.
Set up shims
Once we’ve got our React Native project setup and running, we need to setup a few shims so we can use crypto libraries in React Native.
Install shim dependencies
Register shim modules in Metro
Create or edit your metro.config.js
file in the root of your project so that it includes the following:
Register global shims
Import the following packages at the top of your index.js
file so that libraries that depend on globals like crypto
have access to them.
Install Account Kit and build!
That’s it! Now you can install the packages you want from Account Kit and start building your React Native Account Abstraction app.
The @account-kit/react-native
package is an ESM module. As such, you might have to add the following to your tsconfig.json
’s compilerOptions
:
Add supporting dependencies
To ensure the Signer package works correctly, you’ll need to add the following dependencies to your project:
Build and run your project
Now that we’ve got everything setup, we can build our project!