⚠️ Beta Notice: This SDK is currently in beta and intended for development use only. APIs may change before the stable release. Do not use in production applications. Version 1.0 is expected in August 2025. Please wait for the stable release before deploying to production applications.
A React Native SDK for LastCrash - a comprehensive crash reporting and analytics solution that captures screenshots, monitors app state, and uploads crash reports with visual context.
- Screenshot Capture: Automatically captures screenshots at regular intervals
- Crash Reporting: Integrates with native crash reporting (KSCrash on iOS)
- Network Monitoring: Tracks network requests and responses
- Event Tracking: Custom event tracking and analytics
- ANR Detection: Application Not Responding detection
- Freeze Detection: Detects UI freezes and performance issues
- Cross-Platform: Works on both iOS and Android
npm install react-native-lastcrash
# or
yarn add react-native-lastcrash
After installing, run:
npx pod-install
That’s it! No need to edit your Podfile.
No additional steps required—autolinking will handle everything.
Note: If you are using a monorepo, custom Podfile, or an older version of React Native (<0.60), see the troubleshooting section below.
import LastCrash from 'react-native-lastcrash';
// Configure LastCrash with your API key
LastCrash.configure('your-api-key-here');
// Set up crash delegate (optional)
LastCrash.setCrashReportSenderDelegate();
// Mark app as initialized
LastCrash.applicationInitialized();
import React, { useEffect } from 'react';
import { View, Text, Button } from 'react-native';
import LastCrash from 'react-native-lastcrash';
const App = () => {
useEffect(() => {
// Configure LastCrash
LastCrash.configure('your-api-key-here');
// Set up crash delegate
LastCrash.setCrashReportSenderDelegate();
// Mark app as initialized
LastCrash.applicationInitialized();
// Enable logging (iOS only)
LastCrash.enableLogging();
// Track app open event
LastCrash.event('app_open');
}, []);
const handlePause = () => {
LastCrash.pause();
console.log('Video capture paused');
};
const handleUnpause = () => {
LastCrash.unpause();
console.log('Video capture resumed');
};
const handleCustomEvent = () => {
LastCrash.event('button_clicked', 'test_button');
};
const handleCrash = () => {
// Simulate a crash for testing
throw new Error('Test crash');
};
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>LastCrash Demo</Text>
<Button title="Pause Capture" onPress={handlePause} />
<Button title="Resume Capture" onPress={handleUnpause} />
<Button title="Track Event" onPress={handleCustomEvent} />
<Button title="Test Crash" onPress={handleCrash} />
</View>
);
};
export default App;
Configure LastCrash with your API key.
Set up a delegate to handle crash callbacks.
Enable or disable LastCrash logging (iOS only).
Pause or resume screenshot capture.
Manually send crash reports.
Track a custom event.
Mark the application as initialized.
Add network tracking to the default URL session (iOS only).
Mask a specific view.
Remove a mask from a specific view.
Remove all view masks.
Mask a specific rectangle.
Remove a specific rectangle mask.
Remove all rectangle masks.
Emitted when a crash is detected.
import { DeviceEventEmitter } from 'react-native';
DeviceEventEmitter.addListener('LastCrashDidCrash', (reports) => {
console.log('Crash detected:', reports);
});
- If your Podfile does not include
use_native_modules!
, or you are using a monorepo, you may need to manually add the pod to your Podfile:pod 'react-native-lastcrash', :path => '../node_modules/react-native-lastcrash'
- Then run
npx pod-install
again. - For Android, if autolinking does not work, add the project manually to
settings.gradle
andbuild.gradle
as described in the React Native docs.
For support, please contact support@lastcrash.io or visit our documentation at https://docs.lastcrash.io.