Skip to main content

Installation

Install react-native-rgb in your React Native project.

Package Installation

yarn add react-native-rgb

or

npm install react-native-rgb

iOS Setup

1. Install Pods

The native Rust framework (rgb_libFFI.xcframework) is automatically downloaded during postinstall. After installation, run:

cd ios && pod install

2. Open Workspace

Always use the .xcworkspace file, not the .xcodeproj:

open ios/YourApp.xcworkspace

3. Manual Framework Download (if needed)

If the postinstall script fails, manually download the framework:

node scripts/download-rgb-lib-ios.js

Android Setup

1. Minimum SDK Version

Ensure your android/build.gradle has minSdkVersion set to at least 24:

android {
defaultConfig {
minSdkVersion 24
}
}

2. Repository Configuration

Make sure your android/build.gradle includes JitPack if necessary for transitive dependencies:

allprojects {
repositories {
maven { url 'https://jitpack.io' }
// ... other repositories
}
}

3. Sync Gradle

Sync your Android project in Android Studio or run:

cd android && ./gradlew clean

Verification

After installation, verify the setup by importing the library:

import { generateKeys, BitcoinNetwork } from 'react-native-rgb';

// This should work without errors
const keys = await generateKeys(BitcoinNetwork.TESTNET4);
console.log('Keys generated:', keys.mnemonic);

Troubleshooting

If you encounter issues during installation, see the Troubleshooting guide.