Requirements

  • A React Native project using the latest version
  • iOS and Android platform support (Web is not supported)

Installation

Core Dependencies

Install the Privy React Native SDK and its peer dependencies:

npx expo install expo-application expo-constants expo-web-browser expo-linking expo-secure-store react-native-webview expo-crypto @privy-io/expo-native-extensions @privy-io/expo

Required Polyfills

Install the necessary polyfills:

npm i fast-text-encoding react-native-get-random-values @ethersproject/shims

For Expo bare workflow apps, also run:

npx pod install

Configure Polyfills

Create an entrypoint.js file and update your package.json:

entrypoint.js
// Import required polyfills first
import 'fast-text-encoding';
import 'react-native-get-random-values';
import '@ethersproject/shims';
// Then import the expo router
import 'expo-router/entry';
package.json
{
  "name": "<your app name>",
  "main": "entrypoint.js"
}

If you’re using the @solana/web3.js package, install the buffer dependency:

npm i buffer

And add this code after importing react-native-get-random-values:

import 'react-native-get-random-values';
import {Buffer} from 'buffer';
global.Buffer = Buffer;

Was this page helpful?