Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Updates capture feedback sample
  • Loading branch information
antonis committed Nov 27, 2024
commit 7d2797d2c86dff14354a51f5704816fc0ac223b4
27 changes: 23 additions & 4 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);
```

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: "screenshot.png",
data: "base64-encoded-image",
},
],
}
);
```