Skip to content

Commit e7a9484

Browse files
committed
Revert "Autoinject feedback form (#4370)"
This reverts commit da0e3ea.
1 parent 9853630 commit e7a9484

File tree

4 files changed

+2
-52
lines changed

4 files changed

+2
-52
lines changed

CHANGELOG.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@
1919
...
2020
<FeedbackForm/>
2121
```
22-
or auto-inject it by calling the `showFeedbackForm`:
23-
```jsx
24-
import { showFeedbackForm } from '@sentry/react-native';
25-
...
26-
<Button
27-
title="Show feedback form"
28-
onPress={() => {
29-
showFeedbackForm(_props.navigation);
30-
}}
31-
/>
32-
```
3322

3423
### Changes
3524

packages/core/src/js/feedback/FeedbackForm.tsx

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { SendFeedbackParams } from '@sentry/core';
2-
import { captureFeedback, getCurrentScope, lastEventId, logger } from '@sentry/core';
2+
import { captureFeedback, getCurrentScope, lastEventId } from '@sentry/core';
33
import * as React from 'react';
44
import type { KeyboardTypeOptions } from 'react-native';
55
import {
@@ -21,31 +21,6 @@ import { defaultConfiguration } from './defaults';
2121
import defaultStyles from './FeedbackForm.styles';
2222
import type { FeedbackFormProps, FeedbackFormState, FeedbackFormStyles,FeedbackGeneralConfiguration, FeedbackTextConfiguration } from './FeedbackForm.types';
2323

24-
let feedbackFormHandler: (() => void) | null = null;
25-
26-
const setFeedbackFormHandler = (handler: () => void): void => {
27-
feedbackFormHandler = handler;
28-
};
29-
30-
const clearFeedbackFormHandler = (): void => {
31-
feedbackFormHandler = null;
32-
};
33-
34-
type Navigation = {
35-
navigate: (screen: string, params?: Record<string, unknown>) => void;
36-
};
37-
38-
export const showFeedbackForm = (navigation: Navigation): void => {
39-
setFeedbackFormHandler(() => {
40-
navigation?.navigate?.('FeedbackForm');
41-
});
42-
if (feedbackFormHandler) {
43-
feedbackFormHandler();
44-
} else {
45-
logger.error('FeedbackForm handler is not set. Please ensure it is initialized.');
46-
}
47-
};
48-
4924
/**
5025
* @beta
5126
* Implements a feedback form screen that sends feedback to Sentry using Sentry.captureFeedback.
@@ -73,13 +48,6 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
7348
};
7449
}
7550

76-
/**
77-
* Clear the handler when the component unmounts
78-
*/
79-
public componentWillUnmount(): void {
80-
clearFeedbackFormHandler();
81-
}
82-
8351
public handleFeedbackSubmit: () => void = () => {
8452
const { name, email, description } = this.state;
8553
const { onFormClose } = this.props;

packages/core/src/js/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ export type { TimeToDisplayProps } from './tracing';
8585

8686
export { Mask, Unmask } from './replay/CustomMask';
8787

88-
export { FeedbackForm, showFeedbackForm } from './feedback/FeedbackForm';
88+
export { FeedbackForm } from './feedback/FeedbackForm';

samples/react-native/src/Screens/ErrorsScreen.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
} from 'react-native';
1313

1414
import * as Sentry from '@sentry/react-native';
15-
import { showFeedbackForm } from '@sentry/react-native';
1615

1716
import { setScopeProperties } from '../setScopeProperties';
1817
import { StackNavigationProp } from '@react-navigation/stack';
@@ -227,12 +226,6 @@ const ErrorsScreen = (_props: Props) => {
227226
_props.navigation.navigate('FeedbackForm');
228227
}}
229228
/>
230-
<Button
231-
title="Feedback form (autoinject)"
232-
onPress={() => {
233-
showFeedbackForm(_props.navigation);
234-
}}
235-
/>
236229
<Button
237230
title="Send user feedback"
238231
onPress={() => {

0 commit comments

Comments
 (0)