Skip to content

Commit 991892d

Browse files
authored
Pass screenshotStrategy option from mobileReplayIntegration to the Android SDK (#5808)
* Pass `screenshotStrategy` option from `mobileReplayIntegration` to the Android native SDK * Changelog entry
1 parent f6956cf commit 991892d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
99
## Unreleased
1010

11+
### Fixes
12+
13+
- Pass `screenshotStrategy` option from `mobileReplayIntegration` to the Android native SDK ([#5808](https://github.com/getsentry/sentry-react-native/pull/5808))
14+
1115
### Features
1216

1317
- Add `wrapExpoImage` and `wrapExpoAsset` for Expo performance monitoring ([#5427](https://github.com/getsentry/sentry-react-native/issues/5427))

packages/core/android/src/main/java/io/sentry/react/RNSentryStart.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import io.sentry.SentryEvent;
1212
import io.sentry.SentryLevel;
1313
import io.sentry.SentryOptions.BeforeSendCallback;
14+
import io.sentry.ScreenshotStrategyType;
1415
import io.sentry.SentryReplayOptions;
1516
import io.sentry.UncaughtExceptionHandlerIntegration;
1617
import io.sentry.android.core.AnrIntegration;
@@ -375,6 +376,15 @@ private static SentryReplayOptions getReplayOptions(@NotNull ReadableMap rnOptio
375376
androidReplayOptions.addMaskViewClass("com.horcrux.svg.SvgView"); // react-native-svg
376377
}
377378

379+
if (rnMobileReplayOptions.hasKey("screenshotStrategy")) {
380+
final String strategy = rnMobileReplayOptions.getString("screenshotStrategy");
381+
if ("canvas".equals(strategy)) {
382+
androidReplayOptions.setScreenshotStrategy(ScreenshotStrategyType.CANVAS);
383+
} else {
384+
androidReplayOptions.setScreenshotStrategy(ScreenshotStrategyType.PIXEL_COPY);
385+
}
386+
}
387+
378388
androidReplayOptions.setMaskViewContainerClass(RNSentryReplayMask.class.getName());
379389
androidReplayOptions.setUnmaskViewContainerClass(RNSentryReplayUnmask.class.getName());
380390

0 commit comments

Comments
 (0)