From 9e4af68e44909b7b7d008f7bc171657ddf22e576 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Mon, 18 May 2026 14:21:17 +0200 Subject: [PATCH 1/3] feat(replay): Expose captureSurfaceViews option for Android Session Replay Bridge the Android SDK's captureSurfaceViews option to React Native, allowing replays to include content from SurfaceView components (e.g. video players, map SDKs) that otherwise appear as black regions. Closes #6107 Co-Authored-By: Claude Opus 4.6 --- .../main/java/io/sentry/react/RNSentryStart.java | 5 +++++ packages/core/src/js/replay/mobilereplay.ts | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/packages/core/android/src/main/java/io/sentry/react/RNSentryStart.java b/packages/core/android/src/main/java/io/sentry/react/RNSentryStart.java index 1ab8394b66..cb4cae4309 100644 --- a/packages/core/android/src/main/java/io/sentry/react/RNSentryStart.java +++ b/packages/core/android/src/main/java/io/sentry/react/RNSentryStart.java @@ -419,6 +419,11 @@ private static SentryReplayOptions getReplayOptions(@NotNull ReadableMap rnOptio androidReplayOptions.addMaskViewClass("com.horcrux.svg.SvgView"); // react-native-svg } + if (rnMobileReplayOptions.hasKey("captureSurfaceViews")) { + androidReplayOptions.setCaptureSurfaceViews( + rnMobileReplayOptions.getBoolean("captureSurfaceViews")); + } + if (rnMobileReplayOptions.hasKey("screenshotStrategy")) { final String strategy = rnMobileReplayOptions.getString("screenshotStrategy"); if ("canvas".equals(strategy)) { diff --git a/packages/core/src/js/replay/mobilereplay.ts b/packages/core/src/js/replay/mobilereplay.ts index f1804fbfb0..b8f23a62bc 100644 --- a/packages/core/src/js/replay/mobilereplay.ts +++ b/packages/core/src/js/replay/mobilereplay.ts @@ -124,6 +124,20 @@ export interface MobileReplayOptions { */ screenshotStrategy?: ScreenshotStrategy; + /** + * Enables capturing `SurfaceView` content in Session Replay on Android. + * + * This allows replays to include content from components that render outside the normal + * View hierarchy (e.g. video players, map SDKs) which otherwise appear as black regions. + * + * - Experiment: Masking granularity is at the `SurfaceView` level only. + * - Note: Only works with the `pixelCopy` screenshot strategy (the default). + * + * @default false + * @platform android + */ + captureSurfaceViews?: boolean; + /** * Callback to determine if a replay should be captured for a specific error. * When this callback returns `false`, no replay will be captured for the error. From 62b4f5b4dcf080d52f9916044e4a8fa5e9856ddd Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Mon, 18 May 2026 14:27:52 +0200 Subject: [PATCH 2/3] docs: Add changelog entry for captureSurfaceViews Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9fb55435a..6e8bd53383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Auto-inject `sentry-label` from static text content at build time when `annotateReactComponents` is enabled ([#6141](https://github.com/getsentry/sentry-react-native/pull/6141)) - Respect Replay Mask boundaries when reading `sentry-label` for touch breadcrumbs ([#6142](https://github.com/getsentry/sentry-react-native/pull/6142)) - Add `textComponentNames` option to `annotateReactComponents` for custom text components ([#6169](https://github.com/getsentry/sentry-react-native/pull/6169)) +- Expose `captureSurfaceViews` option for Android Session Replay ([#6175](https://github.com/getsentry/sentry-react-native/pull/6175)) ### Fixes From db307ee1186eb0268b4c7dd3e7dbdf4ac6e1ffce Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Mon, 18 May 2026 14:28:48 +0200 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e8bd53383..69e422cac4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ - Auto-inject `sentry-label` from static text content at build time when `annotateReactComponents` is enabled ([#6141](https://github.com/getsentry/sentry-react-native/pull/6141)) - Respect Replay Mask boundaries when reading `sentry-label` for touch breadcrumbs ([#6142](https://github.com/getsentry/sentry-react-native/pull/6142)) - Add `textComponentNames` option to `annotateReactComponents` for custom text components ([#6169](https://github.com/getsentry/sentry-react-native/pull/6169)) -- Expose `captureSurfaceViews` option for Android Session Replay ([#6175](https://github.com/getsentry/sentry-react-native/pull/6175)) +- Expose experimental `captureSurfaceViews` option for Android Session Replay ([#6175](https://github.com/getsentry/sentry-react-native/pull/6175)) ### Fixes