Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Attach Screenshot Option #2373

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- feat: Adds `attachScreenshot` option.
marandaneto marked this conversation as resolved.
Show resolved Hide resolved

## 4.1.3

fix: Solve reference to private cocoa SDK class #2369
Expand Down
3 changes: 3 additions & 0 deletions android/src/main/java/io/sentry/react/RNSentryModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
// by default we hide.
options.setAttachThreads(rnOptions.getBoolean("attachThreads"));
}
if (rnOptions.hasKey("attachScreenshot")) {
options.setAttachScreenshot(rnOptions.getBoolean("attachScreenshot"));
}
if (rnOptions.hasKey("sendDefaultPii")) {
options.setSendDefaultPii(rnOptions.getBoolean("sendDefaultPii"));
}
Expand Down
2 changes: 2 additions & 0 deletions sample/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Sentry.init({
// release: 'myapp@1.2.3+1',
// dist: `1`,
attachStacktrace: true,
// Attach screenshots to events.
attachScreenshot: true,
});

const Stack = createStackNavigator();
Expand Down
15 changes: 11 additions & 4 deletions src/js/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,18 @@ export interface BaseReactNativeOptions {
patchGlobalPromise?: boolean;

/**
* The max cache items for capping the number of envelopes.
*
* @default 30
*/
* The max cache items for capping the number of envelopes.
*
* @default 30
*/
maxCacheItems?: number;

/**
* When enabled and a user experiences an error, Sentry provides the ability to take a screenshot and include it as an attachment.
*
* @default false
*/
attachScreenshot?: boolean;
}

/**
Expand Down