Loading...
Loading...
Setup Sentry in React Native using the wizard CLI. Use when asked to add Sentry to React Native, install @sentry/react-native, or configure error monitoring for React Native or Expo apps.
npx skill4agent add getsentry/agent-skills sentry-react-native-setupnpx @sentry/wizard@latest -i reactNative| Task | Description |
|---|---|
| Install SDK | Adds |
| Metro config | Adds |
| Expo config | Adds |
| Android setup | Enables Gradle build step for source maps |
| iOS setup | Wraps Xcode build phase, adds debug symbol upload |
| Pod install | Runs |
| Credentials | Stores in |
| Init code | Configures Sentry in |
import * as Sentry from "@sentry/react-native";
Sentry.init({
dsn: "YOUR_SENTRY_DSN",
sendDefaultPii: true,
// Tracing
tracesSampleRate: 1.0,
// Logs
enableLogs: true,
// Profiling
profilesSampleRate: 1.0,
// Session Replay
replaysOnErrorSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
integrations: [Sentry.mobileReplayIntegration()],
});export default Sentry.wrap(App);npx @sentry/wizard@latest -i reactNative| Option | Description | Default |
|---|---|---|
| Sentry DSN | Required |
| Include user data | |
| % of transactions traced | |
| % of traces profiled | |
| Send logs to Sentry | |
| % of error sessions replayed | |
| % of all sessions replayed | |
| File | Purpose |
|---|---|
| Sentry initialization |
| Metro bundler config |
| Expo config (if Expo) |
| iOS build credentials |
| Android build credentials |
| Environment variables |
SENTRY_DSN=https://xxx@o123.ingest.sentry.io/456
SENTRY_AUTH_TOKEN=sntrys_xxx
SENTRY_ORG=my-org
SENTRY_PROJECT=my-projectthrow new Error("My first Sentry error!");<Button title="Test Sentry" onPress={() => { throw new Error("Test"); }} />| Issue | Solution |
|---|---|
| Wizard fails | Try manual setup, check Node version |
| iOS build fails | Run |
| Source maps not uploading | Verify |
| Expo errors | Ensure using compatible Expo SDK version |
| App not wrapped | Add |