Skip to content

Commit 82cc4e0

Browse files
CopilotHazAT
andauthored
fix(react-native-sdk): document shake-to-report feedback feature (SDK v8.5.0) (#78)
* Initial plan * fix(react-native-sdk): document shake-to-report feedback feature for SDK v8.5.0 Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: HazAT <363802+HazAT@users.noreply.github.com> Agent-Logs-Url: https://github.com/getsentry/sentry-for-ai/sessions/d315b3c3-3fd0-4e57-8e3d-904776533e60 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: HazAT <363802+HazAT@users.noreply.github.com>
1 parent 32b0a4a commit 82cc4e0

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

skills/sentry-react-native-sdk/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ These integrations are enabled automatically — no config needed:
681681
| `mobileReplayIntegration()` | Add to `integrations` array |
682682
| `reactNavigationIntegration()` | Add to `integrations` array |
683683
| `reactNativeNavigationIntegration()` | Add to `integrations` array (Wix only) |
684-
| `feedbackIntegration()` | Add to `integrations` array (user feedback widget) |
684+
| `feedbackIntegration()` | Add to `integrations` array (user feedback widget; supports `enableShakeToReport` for native shake detection) |
685685

686686
---
687687

skills/sentry-react-native-sdk/references/user-feedback.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Without `Sentry.wrap`, `Sentry.showFeedbackWidget()` and `Sentry.showFeedbackBut
4040

4141
## Approach 1: Built-In Feedback Widget
4242

43-
The simplest integration. Call `Sentry.showFeedbackWidget()` from anywhere — a button, menu item, shake gesture handler, or support screen.
43+
The simplest integration. Call `Sentry.showFeedbackWidget()` from anywhere — a button, menu item, or support screen. For automatic shake-to-report, see [Shake to Report](#shake-to-report-built-in-native-detection) below.
4444

4545
### Trigger the Widget
4646

@@ -70,6 +70,38 @@ Sentry.showFeedbackButton();
7070
Sentry.hideFeedbackButton();
7171
```
7272

73+
### Shake to Report (Built-In Native Detection)
74+
75+
The SDK provides built-in device shake detection that automatically shows the feedback widget when the user shakes their device. This delegates to native shake detectors in the iOS and Android SDKs — no permissions required.
76+
77+
**Option A: Enable via `feedbackIntegration` config**
78+
79+
```typescript
80+
Sentry.init({
81+
dsn: "YOUR_DSN",
82+
integrations: [
83+
Sentry.feedbackIntegration({ enableShakeToReport: true }),
84+
],
85+
});
86+
```
87+
88+
**Option B: Imperative API (enable/disable at runtime)**
89+
90+
```typescript
91+
import * as Sentry from "@sentry/react-native";
92+
93+
// Start listening for device shakes — shows feedback widget on shake
94+
Sentry.enableFeedbackOnShake();
95+
96+
// Stop listening when no longer needed
97+
Sentry.disableFeedbackOnShake();
98+
```
99+
100+
> **Platform details:**
101+
> - **iOS:** Uses UIKit motion event detection (`SentryShakeDetector`)
102+
> - **Android:** Uses accelerometer sensor (`SentryShakeDetector`)
103+
> - **Web:** Not supported — shake detection is native-only
104+
73105
### Configure the Widget via `feedbackIntegration`
74106

75107
Customize appearance and fields in `Sentry.init`:
@@ -638,6 +670,7 @@ Returns the feedback event ID (or `undefined` if SDK is disabled).
638670
| `isNameRequired` | `boolean` | `false` | Make name field required |
639671
| `isEmailRequired` | `boolean` | `false` | Make email field required |
640672
| `useSentryUser` | `object` | — | Maps Sentry user scope fields to pre-fill name/email |
673+
| `enableShakeToReport` | `boolean` | `false` | Show feedback widget when the user shakes the device (native iOS/Android only) |
641674
| `styles` | `object` | — | Style overrides for widget UI elements |
642675
643676
---
@@ -649,6 +682,8 @@ Returns the feedback event ID (or `undefined` if SDK is disabled).
649682
| `Sentry.showFeedbackWidget()` | Open the built-in feedback modal |
650683
| `Sentry.showFeedbackButton()` | Show the persistent floating feedback button |
651684
| `Sentry.hideFeedbackButton()` | Hide the persistent floating feedback button |
685+
| `Sentry.enableFeedbackOnShake()` | Start native shake detection to show feedback widget |
686+
| `Sentry.disableFeedbackOnShake()` | Stop native shake detection |
652687
| `Sentry.captureFeedback(feedback, hint?)` | Submit feedback programmatically |
653688
| `Sentry.lastEventId()` | Get the ID of the most recent captured event (for linking) |
654689
| `Sentry.feedbackIntegration(options)` | Configure the built-in widget |
@@ -664,6 +699,7 @@ Returns the feedback event ID (or `undefined` if SDK is disabled).
664699
| `feedbackIntegration()` | ≥6.9.0 | Configure widget appearance |
665700
| `FeedbackWidget` component | ≥6.9.0 | Inline embedded widget |
666701
| `showFeedbackButton()` / `hideFeedbackButton()` | ≥6.15.0 | Floating feedback button |
702+
| `enableShakeToReport` / `enableFeedbackOnShake()` | ≥8.5.0 | Native shake detection (iOS & Android) |
667703
| Offline caching | Built-in | Automatic, no config needed |
668704
| Session Replay attachment | ≥6.9.0 | When `mobileReplayIntegration` enabled |
669705
| New Architecture (Fabric) support | React Native ≥0.71 | Widget works on new arch |
@@ -743,3 +779,5 @@ Sentry.captureFeedback({
743779
| Replay not attaching to feedback | Confirm `mobileReplayIntegration()` is in `integrations` and the app is running as a native build |
744780
| `associatedEventId` not linking correctly | Pass the exact event ID string returned by `captureException`, `captureMessage`, or `lastEventId()` |
745781
| Widget styles not applying | Pass `styles` config inside `feedbackIntegration({ styles: { ... } })` in `Sentry.init` |
782+
| Shake to report not working | Confirm `Sentry.wrap(App)` wraps your root component; shake detection is native-only (not available on Web or Expo Go) |
783+
| Shake detected but widget doesn't appear | Ensure `feedbackIntegration()` is in the `integrations` array; check `debug: true` for logs |

0 commit comments

Comments
 (0)