$npx -y skills add getsentry/sentry-for-ai --skill sentry-react-native-sdkFull Sentry SDK setup for React Native and Expo. Use when asked to "add Sentry to React Native", "install @sentry/react-native", "setup Sentry in Expo", or configure error monitoring, tracing, profiling, session replay, or logging for React Native applications. Supports Expo mana
| 1 | > [All Skills](../../SKILL_TREE.md) > [SDK Setup](../sentry-sdk-setup/SKILL.md) > React Native SDK |
| 2 | |
| 3 | # Sentry React Native SDK |
| 4 | |
| 5 | Opinionated wizard that scans your React Native or Expo project and guides you through complete Sentry setup — error monitoring, tracing, profiling, session replay, logging, and more. |
| 6 | |
| 7 | ## Invoke This Skill When |
| 8 | |
| 9 | - User asks to "add Sentry to React Native" or "set up Sentry" in an RN or Expo app |
| 10 | - User wants error monitoring, tracing, profiling, session replay, or logging in React Native |
| 11 | - User mentions `@sentry/react-native`, mobile error tracking, or Sentry for Expo |
| 12 | - User wants to monitor native crashes, ANRs, or app hangs on iOS/Android |
| 13 | |
| 14 | > **Note:** SDK versions and APIs below reflect current Sentry docs at time of writing (`@sentry/react-native` ≥6.0.0, minimum recommended ≥8.0.0). |
| 15 | > Always verify against [docs.sentry.io/platforms/react-native/](https://docs.sentry.io/platforms/react-native/) before implementing. |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | ## Phase 1: Detect |
| 20 | |
| 21 | Run these commands to understand the project before making any recommendations: |
| 22 | |
| 23 | ```bash |
| 24 | # Detect project type and existing Sentry |
| 25 | cat package.json | grep -E '"(react-native|expo|@expo|@sentry/react-native|sentry-expo)"' |
| 26 | |
| 27 | # Distinguish Expo managed vs bare vs vanilla RN |
| 28 | ls app.json app.config.js app.config.ts 2>/dev/null |
| 29 | cat app.json 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); print('Expo managed' if 'expo' in d else 'Bare/Vanilla')" 2>/dev/null |
| 30 | |
| 31 | # Check Expo SDK version (important: Expo SDK 50+ required for @sentry/react-native) |
| 32 | cat package.json | grep '"expo"' |
| 33 | |
| 34 | # Detect navigation library |
| 35 | grep -E '"(@react-navigation/native|react-native-navigation)"' package.json |
| 36 | |
| 37 | # Detect state management (Redux → breadcrumb integration available) |
| 38 | grep -E '"(redux|@reduxjs/toolkit|zustand|mobx)"' package.json |
| 39 | |
| 40 | # Check for existing Sentry initialization |
| 41 | grep -r "Sentry.init" src/ app/ App.tsx App.js _layout.tsx 2>/dev/null | head -5 |
| 42 | |
| 43 | # Detect Hermes (affects source map handling) |
| 44 | cat android/app/build.gradle 2>/dev/null | grep -i hermes |
| 45 | cat ios/Podfile 2>/dev/null | grep -i hermes |
| 46 | |
| 47 | # Detect Expo Router |
| 48 | ls app/_layout.tsx app/_layout.js 2>/dev/null |
| 49 | |
| 50 | # Detect backend for cross-link |
| 51 | ls backend/ server/ api/ 2>/dev/null |
| 52 | find . -maxdepth 3 \( -name "go.mod" -o -name "requirements.txt" -o -name "Gemfile" -o -name "package.json" \) 2>/dev/null | grep -v node_modules | head -10 |
| 53 | ``` |
| 54 | |
| 55 | **What to determine:** |
| 56 | |
| 57 | | Question | Impact | |
| 58 | |----------|--------| |
| 59 | | `expo` in `package.json`? | Expo path (config plugin + `getSentryExpoConfig`) vs bare/vanilla RN path | |
| 60 | | Expo SDK ≥50? | `@sentry/react-native` directly; older = `sentry-expo` (legacy, do not use) | |
| 61 | | `app.json` has `"expo"` key? | Managed Expo — wizard is simplest; config plugin handles all native config | |
| 62 | | `app/_layout.tsx` present? | Expo Router project — init goes in `_layout.tsx` | |
| 63 | | `@sentry/react-native` already in `package.json`? | Skip install, jump to feature config | |
| 64 | | `@react-navigation/native` present? | Recommend `reactNavigationIntegration` for screen tracking | |
| 65 | | `react-native-navigation` present? | Recommend `reactNativeNavigationIntegration` (Wix) | |
| 66 | | Backend directory detected? | Trigger Phase 4 cross-link | |
| 67 | |
| 68 | --- |
| 69 | |
| 70 | ## Phase 2: Recommend |
| 71 | |
| 72 | Present a concrete recommendation based on what you found. Don't ask open-ended questions — lead with a proposal: |
| 73 | |
| 74 | **Recommended (core coverage — always set up these):** |
| 75 | - ✅ **Error Monitoring** — captures JS exceptions, native crashes (iOS + Android), ANRs, and app hangs |
| 76 | - ✅ **Tracing** — mobile performance is critical; auto-instruments navigation, app start, network requests |
| 77 | - ✅ **Session Replay** — mobile replay captures screenshots and touch events for debugging user issues |
| 78 | |
| 79 | **Optional (enhanced observability):** |
| 80 | - ⚡ **Profiling** — CPU profiling on iOS (JS profiling cross-platform); low overhead in production |
| 81 | - ⚡ **Logging** — structured logs via `Sentry.logger.*`; links to traces for full context |
| 82 | - ⚡ **User Feedback** — collect user-submitted bug reports directly from your app |
| 83 | |
| 84 | **Recommendation logic:** |
| 85 | |
| 86 | | Feature | Recommend when... | |
| 87 | |---------|------------------| |
| 88 | | Error Monitoring | **Always** — non-negotiable baseline for any mobile app | |
| 89 | | Tracing | **Always for mobile** — app start, navigation, and network latency matter | |
| 90 | | Session Replay | User-facing production app; debug user-reported issues visually | |
| 91 | | Profiling | Performance-sensitive screens, startup time concerns, or production perf investigations | |
| 92 | | Logging | App uses structured logging, or you want log-to-trac |