Skip to content

Commit

Permalink
RN: Updates capture feedback documentation (#11980)
Browse files Browse the repository at this point in the history
* Updates capture feedback sample

* Update platform-includes/user-feedback/sdk-api-example/react-native.mdx

Co-authored-by: Krystof Woldrich <[email protected]>

* Update platform-includes/user-feedback/sdk-api-example/react-native.mdx

Co-authored-by: Krystof Woldrich <[email protected]>

* Use the simpler text attachment

---------

Co-authored-by: Krystof Woldrich <[email protected]>
  • Loading branch information
antonis and krystofwoldrich authored Feb 13, 2025
1 parent 7887511 commit 842d2c5
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions platform-includes/user-feedback/sdk-api-example/react-native.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
```typescript
import * as Sentry from "@sentry/react-native";
import { UserFeedback } from "@sentry/react-native";
import { SendFeedbackParams } from "@sentry/react-native";

const sentryId = Sentry.captureMessage("My Message");
// OR: const sentryId = Sentry.lastEventId();

const userFeedback: UserFeedback = {
event_id: sentryId,
const userFeedback: SendFeedbackParams = {
name: "John Doe",
email: "[email protected]",
comments: "Hello World!",
message: "Hello World!",
associatedEventId: eventId, // Optional
};

Sentry.captureUserFeedback(userFeedback);
Sentry.captureFeedback(userFeedback);
```

You can also attach further data to the feedback event by passing a hint as a second argument. This is similar to other `capture` methods:

```javascript
Sentry.captureFeedback(
{ message: "I really like your App, thanks!" },
{
captureContext: {
tags: { key: "value" },
},
attachments: [
{
filename: 'hello.txt',
data: 'Hello, World!',
},
],
}
);
```

0 comments on commit 842d2c5

Please sign in to comment.