Skip to content

Commit

Permalink
remove deprecated get attachment and fix deprecated configurescope
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-zimerman committed Feb 26, 2025
1 parent d053743 commit 6f58785
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions samples/react-native/src/Screens/ErrorsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,29 +185,20 @@ const ErrorsScreen = (_props: Props) => {
<Button
title="Add attachment"
onPress={() => {
Sentry.configureScope(scope => {
const scope = Sentry.getGlobalScope();
scope.addAttachment({
data: 'Attachment content',
filename: 'attachment.txt',
contentType: 'text/plain',
});
if (data) {
scope.addAttachment({
data: 'Attachment content',
filename: 'attachment.txt',
contentType: 'text/plain',
data,
filename: 'logo.png',
contentType: 'image/png',
});
if (data) {
scope.addAttachment({
data,
filename: 'logo.png',
contentType: 'image/png',
});
}
console.log('Sentry attachment added.');
});
}}
/>
<Button
title="Get attachments"
onPress={async () => {
Sentry.configureScope(scope => {
console.log('Attachments:', scope.getAttachments());
});
}
console.log('Sentry attachment added.');
}}
/>
<Button
Expand Down

0 comments on commit 6f58785

Please sign in to comment.