React Native SDK
v0.6.0betaIntegrate BugScreen into your React Native or Expo app. TypeScript wrapper bridging the native iOS and Android SDKs.
Installation
Bare React Native
Install the package with your package manager:
npm install @bugscreen/react-native
# or: yarn add @bugscreen/react-native
# or: pnpm add @bugscreen/react-nativeThen install the iOS pods. The SDK is autolinked, so no manual native linking is needed:
cd ios && bundle exec pod installRequires React Native 0.74+, iOS 15+, and Android 7.0+ (API 24).
Expo (managed)
Install the package, then add the config plugin so you don't need to run expo prebuild by hand:
npx expo install @bugscreen/react-nativeAdd the plugin to your app.json (the photoLibraryUsageDescription sets the iOS Info.plist string used when attaching screenshots):
{
"expo": {
"plugins": [
[
"@bugscreen/react-native",
{ "photoLibraryUsageDescription": "Used to attach screenshots to bug reports." }
]
]
}
}Then build a dev client — the SDK contains native code, so it does not run in Expo Go:
npx expo prebuild
# then run a development build, e.g.
eas build --profile developmentSetup
Initialise the SDK once, early in your app's lifecycle. BugScreen is for dev/QA — gate configure(...) so it doesn't run for end users.
import { useEffect } from 'react';
import { BugScreen } from '@bugscreen/react-native';
export default function App() {
useEffect(() => {
BugScreen.configure({
apiKey: 'fb_your_api_key_here',
screenshotDetection: true,
debug: __DEV__,
}).catch((err) => console.warn('BugScreen configure failed', err));
}, []);
// ...your app
}Permissions
iOS: add an NSPhotoLibraryUsageDescription string to your Info.plist so the SDK can attach screenshots. The Expo config plugin adds this automatically; for bare React Native, add it yourself:
<key>NSPhotoLibraryUsageDescription</key>
<string>Used to attach screenshots to bug reports.</string>Android: the required permissions merge into your app automatically from the native library — no manifest changes needed. On Android 13 and below, request the media-read permission once at startup so screenshot detection works:
useEffect(() => {
BugScreen.shouldRequestPermission().then((needed) =>
needed ? BugScreen.requestScreenshotPermission() : true
);
}, []);Platform.OS check.Usage
Automatic screenshot detection
When users take a screenshot, BugScreen automatically shows the bug report screen. That's it — no extra wiring.
Manual triggering
Open the bug report screen programmatically:
BugScreen.presentBugReport();Logging
Add context to bug reports with application logs:
import { BugScreen, LogLevel } from '@bugscreen/react-native';
BugScreen.log('User tapped checkout button', LogLevel.Info);
BugScreen.log('Payment failed', LogLevel.Error);Logs are automatically included with every bug report.
Custom data
Attach arbitrary key/value pairs to every subsequent bug report:
// Replace the whole map:
BugScreen.setCustomData({ env: 'staging', buildType: 'debug', userTier: 'pro' });
// Set or remove a single key:
BugScreen.setCustomDataValue('userId', 'abc-123');
BugScreen.removeCustomData('userId');
// Merge a map without replacing existing keys:
BugScreen.addCustomData({ plan: 'pro', region: 'eu' });
// Remove all custom data:
BugScreen.clearCustomData();Call any time after configure(). The values are read when the bug report screen opens and appear in the report's metadata.
Configuration
Pass these options to BugScreen.configure(...):
| Option | Default | Description |
|---|---|---|
| apiKey: string | Required | Your API key from the BugScreen console (must start with "fb_") |
| screenshotDetection?: boolean | true | Auto-detect screenshots and show the report UI |
| debug?: boolean | false | Enable verbose debug logging from the SDK (use __DEV__) |
What gets collected?
BugScreen automatically collects this information with each report:
- •Device model & manufacturer
- •OS name & version
- •App version & build number
- •Screen size & density
- •Memory (total & available)
- •Device locale
- •BugScreen SDK version
Start shipping bug reports
Create an account to start shipping bug reports from your app.