React Native SDK
Set up incident capture and source maps in React Native or Expo.
Availability: SDK 0.3.19
This guide describes @happycatlabs/dancer-react-native 0.3.19. The package requires approved access to the restricted package scope. Verify your app's installed version and init overrides before using its default endpoint to diagnose a live app.
npm install @happycatlabs/dancer-react-native
For a React Native app, initialize once near the root:
import { addBreadcrumb, captureException, init } from "@happycatlabs/dancer-react-native";
init({ projectKey: "your-project-key" });
addBreadcrumb({ message: "save tapped", category: "ui.action" });
captureException(new Error("Example failure"), { screen: "editor" });
For an Expo app, add the package's Expo plugin with the project key in app.config.ts:
export default {
expo: {
plugins: [["@happycatlabs/dancer-react-native/expo", { projectKey: "your-project-key" }]],
},
};
Add the Metro helper in metro.config.js:
const { getDancerExpoConfig } = require("@happycatlabs/dancer-react-native/metro");
module.exports = getDancerExpoConfig(__dirname);
Then call init() and wrap the root layout with Dancer.wrap. The plugin supplies the project target and bundle metadata. The Metro helper stamps a matching debug ID and uploads matching source maps in supported EAS build and update paths. Keep the usual eas build and eas update commands.
import { Stack } from "expo-router";
import * as Dancer from "@happycatlabs/dancer-react-native";
Dancer.init();
function RootLayout() {
return <Stack />;
}
export default Dancer.wrap(RootLayout);
track(name, properties?) records a bounded product event; flushEvents() drains one product batch. Product properties must not contain personal data, credentials, prompts, or arbitrary URLs. The project key is a write-only telemetry key, not a read credential. Use dsn or projectKey with ingestUrl only for an intentional target override.