Expo and React Native support is a new feature in v0.3 with specialized providers for mobile environments.
Overview
React Native and Expo applications require special handling for:- Server-Sent Events (SSE): Standard EventSource doesn’t work in React Native
- Streaming: JSON streaming requires custom fetch implementation
- Cryptography:
crypto.getRandomValues()polyfill is required
Installation
First, install the required dependencies:Crypto Polyfill Setup
Add this at the top of your app entry point (before any SDK imports):Basic Setup
Create a wallet with Expo-compatible providers:Understanding Expo Providers
The SDK includes two specialized providers for Expo/React Native:ExpoArkProvider
Handles settlement events and transaction streaming usingexpo/fetch for Server-Sent Events:
ExpoIndexerProvider
Handles address subscriptions and VTXO updates usingexpo/fetch for JSON streaming:
Both providers follow the SDK’s modular architecture pattern, keeping the main bundle clean while providing opt-in functionality for specific environments.
Complete Example
Here’s a complete React Native component with wallet integration:Using AsyncStorage
First install:AsyncStorageAdapter:
Common Issues
Crypto Not Defined
Error:crypto is not defined or crypto.getRandomValues is not a function
Solution: Ensure the crypto polyfill is set up before importing the SDK:
EventSource Not Available
Error:EventSource is not defined
Solution: Use ExpoArkProvider and ExpoIndexerProvider instead of default providers:
AsyncStorage Errors
Error:AsyncStorage is null
Solution: Make sure you’re using AsyncStorageAdapter from the SDK:
Testing on Devices
When testing on physical devices or emulators:- Make sure your device can reach the Arkade server URL
- Use a publicly accessible server (not localhost)
- Check network permissions in your app configuration