@flaggr/react-native
v0.1.0
Published
Crash and error reporting for React Native and Expo apps, with the feature-flag variants each crash happened under — Flaggr's Issues page
Downloads
331
Maintainers
Readme
@flaggr/react-native
Crash and error reporting for React Native and Expo apps. Crashes show up on Flaggr's Issues page with the feature-flag variants they happened under. The Releases view shows each release's crash-free session rate.
npm install @flaggr/react-native @react-native-async-storage/async-storageimport AsyncStorage from "@react-native-async-storage/async-storage";
import { flaggrReactNative } from "@flaggr/react-native";
export const errors = flaggrReactNative({
siteId: "site_…", // the app's Site in Flaggr
release: "[email protected]+45",
environment: __DEV__ ? "development" : "production",
storage: AsyncStorage, // keeps a fatal crash for the next launch
});
errors.install();
// With @flaggr/sdk the reporter is also a plugin, so crashes carry the evaluated variants:
// createFlaggr({ serviceId: "mobile-app", apiKey: "fgr_…", plugins: [errors] })
errors.captureException(error, { tags: { screen: "Checkout" } });
errors.trackScreen("Checkout"); // e.g. from React Navigation's onStateChangeWhat it does:
- Catches JavaScript crashes and errors (React Native's global handler) and unhandled promise rejections.
- Records breadcrumbs for flag evaluations, console warnings, fetches, app state changes and screens.
- Reports each launch as a session, for crash-free rates.
- Doesn't catch native crashes (Objective-C, Swift, Java, Kotlin or C++).
MIT licensed.
