Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN: Updates capture feedback documentation #11980

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
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
antonis marked this conversation as resolved.
Show resolved Hide resolved
};

Sentry.captureUserFeedback(userFeedback);
antonis marked this conversation as resolved.
Show resolved Hide resolved
```

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",
},
],
}
);
```