React Native SDK
Free and open source (MIT) — published as react-native-logtryl-crash on npm. See the SDK Overview page first for how recording actually works.
Install
yarn add react-native-logtryl-crash react-native-nitro-modules @react-native-async-storage/async-storage
cd ios && pod installExpo (managed) — add the config plugin to app.json/app.config.js:
{ "expo": { "plugins": ["react-native-logtryl-crash"] } }Quick start
Call this once, as early as possible — e.g. the top of your root component:
import { initCrashReporting } from 'react-native-logtryl-crash';
initCrashReporting('YOUR_PROJECT_KEY');Grab your project key from the project’s Edit page in the Dashboard or Desktop app — see Getting your project key on the SDK Overview page.
Pairing a device
The easiest way in is the built-in PairingDrawer component — a swipe-out drawer with a code-entry UI:
import { PairingDrawer } from 'react-native-logtryl-crash';
export default function App() {
return (
<>
{/* your app */}
<PairingDrawer edge="right" />
</>
);
}Or drive it yourself with pairDevice(code) / isPaired() / unpairDevice().
Recording a handled exception manually
Flag a caught exception as worth including in the active recording, even though it didn’t crash the app:
import { recordHandledError } from 'react-native-logtryl-crash';
try {
await riskyOperation();
} catch (err) {
recordHandledError(err);
}This only does anything while a debug recording is active — it’s not general-purpose logging.
If the app crashes during a recording
API reference
initCrashReporting(appKey, options?)— installs fatal-crash capture and configures pairing/polling.appKeyis your project key (see above).recordHandledError(error)— manually records a caught exception into the active recording.pairDevice(code)/isPaired()/unpairDevice()— drive pairing yourself instead of (or alongside)PairingDrawer.getPendingCrashReports()/addCrashListener(callback)— read fatal crash reports captured on this device directly, for your own logging/QA needs on top of what Logtryl already shows.
