Skip to content
Prev Previous commit
Next Next commit
Adds new feedback button in the sample
  • Loading branch information
antonis committed Nov 27, 2024
commit 42e2fa14823f067a6b4088770f5ff0aea9a22b69
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { View, StyleSheet, Text, TextInput, Image, Button } from 'react-native';
import * as Sentry from '@sentry/react-native';
import { UserFeedback } from '@sentry/react-native';
import { SendFeedbackParams, UserFeedback } from '@sentry/react-native';

export const DEFAULT_COMMENTS = "It's broken again! Please fix it.";

Expand Down Expand Up @@ -48,6 +48,23 @@ export function UserFeedbackModal(props: { onDismiss: () => void }) {
}}
/>
<View style={styles.buttonSpacer} />
<Button
title="Send feedback without event"
color="#6C5FC7"
onPress={async () => {
onDismiss();

const userFeedback: SendFeedbackParams = {
message: comments,
name: 'John Doe',
email: '[email protected]',
};

Sentry.captureFeedback(userFeedback);
clearComments();
}}
/>
<View style={styles.buttonSpacer} />
<Button
title="Close"
color="#6C5FC7"
Expand Down
19 changes: 18 additions & 1 deletion samples/react-native/src/components/UserFeedbackModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { View, StyleSheet, Text, TextInput, Image, Button } from 'react-native';
import * as Sentry from '@sentry/react-native';
import { UserFeedback } from '@sentry/react-native';
import { SendFeedbackParams, UserFeedback } from '@sentry/react-native';

export const DEFAULT_COMMENTS = "It's broken again! Please fix it.";

Expand Down Expand Up @@ -48,6 +48,23 @@ export function UserFeedbackModal(props: { onDismiss: () => void }) {
}}
/>
<View style={styles.buttonSpacer} />
<Button
title="Send feedback without event"
color="#6C5FC7"
onPress={async () => {
onDismiss();

const userFeedback: SendFeedbackParams = {
message: comments,
name: 'John Doe',
email: '[email protected]',
};

Sentry.captureFeedback(userFeedback);
clearComments();
}}
/>
<View style={styles.buttonSpacer} />
<Button
title="Close"
color="#6C5FC7"
Expand Down
Loading