Skip to content

Commit 842d2c5

Browse files
RN: Updates capture feedback documentation (#11980)
* 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]>
1 parent 7887511 commit 842d2c5

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
11
```typescript
22
import * as Sentry from "@sentry/react-native";
3-
import { UserFeedback } from "@sentry/react-native";
3+
import { SendFeedbackParams } from "@sentry/react-native";
44

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

8-
const userFeedback: UserFeedback = {
9-
event_id: sentryId,
8+
const userFeedback: SendFeedbackParams = {
109
name: "John Doe",
1110
12-
comments: "Hello World!",
11+
message: "Hello World!",
12+
associatedEventId: eventId, // Optional
1313
};
1414

15-
Sentry.captureUserFeedback(userFeedback);
15+
Sentry.captureFeedback(userFeedback);
1616
```
17+
18+
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:
19+
20+
```javascript
21+
Sentry.captureFeedback(
22+
{ message: "I really like your App, thanks!" },
23+
{
24+
captureContext: {
25+
tags: { key: "value" },
26+
},
27+
attachments: [
28+
{
29+
filename: 'hello.txt',
30+
data: 'Hello, World!',
31+
},
32+
],
33+
}
34+
);
35+
```

0 commit comments

Comments
 (0)