Skip to content

Commit 42500ad

Browse files
antonislucas-zimermankrystofwoldrich
authored
RN: Adds feedback button doc (#13512)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ⚠️ PR Chain: - 👉 #13512 - #13513 - #13515 ## DESCRIBE YOUR PR *Tell us what you're changing and why. If your PR **resolves an issue**, please link it so it closes automatically.* Adds feedback button documentation. Part of getsentry/sentry-react-native#4302 Implementation PR: getsentry/sentry-react-native#4378 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ Should be merged after getsentry/sentry-react-native#4726 is released ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com> Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>
1 parent 076ab90 commit 42500ad

File tree

3 files changed

+65
-4
lines changed

3 files changed

+65
-4
lines changed

docs/platforms/react-native/user-feedback/configuration/index.mdx

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,25 @@ description: "Learn about the User Feedback Widget configuration options."
77
The User Feedback Widget offers many customization options, and if the available options are insufficient, you can [use your own UI](/platforms/react-native/user-feedback/#user-feedback-api).
88

99
![An image showing the main customization options for the User Feedback Widget](./img/mobile-user-feedback-widget-customization.png)
10-
To collect user feedback from inside your application use the `showFeedbackWidget` method.
10+
To collect user feedback from inside your application, use the `showFeedbackButton`/`hideFeedbackButton` to show/hide a button that triggers the Feedback Widget or the `showFeedbackWidget` method to present the widget directly.
1111

12-
```javascript
12+
```JavaScript {tabTitle:Widget}
1313
import * as Sentry from "@sentry/react-native";
1414

1515
Sentry.wrap(RootComponent);
1616

1717
Sentry.showFeedbackWidget();
1818
```
1919

20+
```JavaScript {tabTitle:Button}
21+
import * as Sentry from "@sentry/react-native";
22+
23+
Sentry.wrap(RootComponent);
24+
25+
Sentry.showFeedbackButton();
26+
Sentry.hideFeedbackButton();
27+
```
28+
2029
Note that [the root application component must be wrapped with `Sentry.wrap`](/platforms/react-native/#wrap-your-app) for this to work.
2130

2231
## General
@@ -127,6 +136,47 @@ The following styles are available for customisation.
127136
| `screenshotThumbnail` | `ImageStyle` | The screenshot thumbnail image style. |
128137
| `titleContainer` | `ViewStyle` | The title container style. |
129138

139+
## Feedback Button Customization
140+
141+
You can customize placement of the feedback button, as well as the fonts and colors.
142+
143+
The example below shows how to customize the bottom margin with the `feedbackIntegration`.
144+
145+
```javascript
146+
import * as Sentry from "@sentry/react-native";
147+
148+
Sentry.init({
149+
integrations: [
150+
Sentry.feedbackIntegration({
151+
buttonOptions: {
152+
styles: {
153+
triggerButton: {
154+
marginBottom: 75,
155+
},
156+
},
157+
},
158+
}),
159+
],
160+
});
161+
162+
Sentry.showFeedbackButton();
163+
```
164+
165+
You can customize the button text with the following options.
166+
167+
| Key | Default | Description |
168+
| ------------------ | ---------------- | -------------------------------------------------------------------- |
169+
| `triggerLabel` | `"Report a Bug"` | The label for the Feedback widget button that opens the dialog. |
170+
| `triggerAriaLabel` | - | The aria label for the Feedback widget button that opens the dialog. |
171+
172+
The following styles are available for customisation.
173+
174+
| Style | Type | Description |
175+
| --------------- | ------------ | --------------------------------- |
176+
| `triggerButton` | `ViewStyle` | The feedback widget button style. |
177+
| `triggerText` | `TextStyle` | The feedback widget text style. |
178+
| `triggerIcon` | `ImageStyle` | The feedback widget icon style. |
179+
130180
## Event Callbacks
131181

132182
The following callbacks can be configured for the integration in `feedbackIntegration({})` or passed in the `FeedbackWidget` component props:

docs/platforms/react-native/user-feedback/index.mdx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,20 @@ Sentry.wrap(RootComponent);
2323
Sentry.showFeedbackWidget();
2424
```
2525

26-
Note that [the root application component must be wrapped with `Sentry.wrap`](/platforms/react-native/#wrap-your-app) for the `showFeedbackWidget` method to work. The method depends on the React Native `Modal` implementation. It is supported fully in the legacy architecture. For the new architecture (Fabric renderer) it requires React Native `0.71` and up.
26+
You may also use the `showFeedbackButton` and `hideFeedbackButton` to show and hide a button that opens the Feedback Widget.
2727

28-
To configure the widget you can use the `Sentry.feedbackIntegration({})` or add it to your Sentry initialization.
28+
```javascript
29+
import * as Sentry from "@sentry/react-native";
30+
31+
Sentry.wrap(RootComponent);
32+
33+
Sentry.showFeedbackWidget();
34+
Sentry.hideFeedbackButton();
35+
```
36+
37+
Note that [the root application component must be wrapped with `Sentry.wrap`](/platforms/react-native/#wrap-your-app) for the `showFeedbackWidget` and `showFeedbackButton` methods to work. The methods depend on the React Native `Modal` implementation. It is supported fully in the legacy architecture. For the new architecture (Fabric renderer) it requires React Native `0.71` and up.
38+
39+
To configure the widget or the button you can use the `Sentry.feedbackIntegration({})` or add it to your Sentry initialization.
2940

3041
```javascript
3142
import * as Sentry from "@sentry/react-native";

0 commit comments

Comments
 (0)