From 26158ea8500010a0048e18c746d5fb6fbc1c2e86 Mon Sep 17 00:00:00 2001 From: Alexander Pantiukhov Date: Tue, 10 Nov 2026 11:38:29 +0100 Subject: [PATCH 1/2] fix(ios): Register replay mask classes when sample rates are 0 RNSentryStart ran RNSentryReplay postInit only when a replay sample rate was above 0. Since 8.27 you can start a replay manually with both rates at 0, and sentry-cocoa always installs the replay integration. Such a replay recorded without the RN mask and unmask container classes and without the RN breadcrumb converter, so Sentry.Unmask and Sentry.Mask had no effect. postInit now runs whenever replay is supported. It starts no recording. It only configures the installed integration, and the cocoa calls do nothing when the integration is missing. A new OCMock test starts the SDK with both rates at 0 and checks that postInit runs. It fails with the old condition. Fixes #6996 --- CHANGELOG.md | 4 ++++ .../RNSentryCocoaTesterTests/RNSentryTests.m | 17 +++++++++++++++++ packages/core/ios/RNSentryStart.m | 6 ++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb250b130..cef1a49d41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ }); ``` +### Fixes + +- Apply `Sentry.Mask` and `Sentry.Unmask` on iOS when you start a replay manually with both replay sample rates at `0` ([#PR_NUMBER](https://github.com/getsentry/sentry-react-native/pull/PR_NUMBER)) + ### Dependencies - Bump Android SDK from v8.62.0 to v8.63.0 ([#6990](https://github.com/getsentry/sentry-react-native/pull/6990)) diff --git a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m index 4e7b3d0da2..049b51eaea 100644 --- a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m +++ b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m @@ -290,6 +290,23 @@ - (void)testStartWithDictionaryRemovesPerformanceProperties // Tracing is disabled by setting tracesSampleRate and tracesSampler to nil } +- (void)testStartRunsReplayPostInitWhenSampleRatesAreZero +{ + id replayMock = OCMClassMock([RNSentryReplay class]); + NSError *error = nil; + + NSDictionary *_Nonnull mockedReactNativeDictionary = @{ + @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", + @"replaysSessionSampleRate" : @0, + @"replaysOnErrorSampleRate" : @0, + }; + [RNSentryStart startWithOptions:mockedReactNativeDictionary error:&error]; + + XCTAssertNil(error); + OCMVerify(ClassMethod([replayMock postInit])); + [replayMock stopMocking]; +} + - (void)testStartCaptureFailedRequestsIsDisabled { NSError *error = nil; diff --git a/packages/core/ios/RNSentryStart.m b/packages/core/ios/RNSentryStart.m index 87591dae79..c56bd40267 100644 --- a/packages/core/ios/RNSentryStart.m +++ b/packages/core/ios/RNSentryStart.m @@ -59,10 +59,8 @@ + (void)startWithOptions:(SentryOptions *)options jsSdkVersion:(NSString *_Nulla [SentrySDK startWithOptions:options]; #if SENTRY_TARGET_REPLAY_SUPPORTED - if (options.sessionReplay.sessionSampleRate > 0 - || options.sessionReplay.onErrorSampleRate > 0) { - [RNSentryReplay postInit]; - } + // Replay can start manually with both sample rates at 0, so always register the RN classes. + [RNSentryReplay postInit]; #endif [self postDidBecomeActiveNotification]; From 64f377426be73cb4b5d92e2647e1b0f6f11532d9 Mon Sep 17 00:00:00 2001 From: Alexander Pantiukhov Date: Tue, 10 Nov 2026 11:45:32 +0100 Subject: [PATCH 2/2] docs(changelog): Link replay mask fix to its PR Replace the PR number placeholder in the changelog entry with #7008. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cef1a49d41..26502bf6b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ ### Fixes -- Apply `Sentry.Mask` and `Sentry.Unmask` on iOS when you start a replay manually with both replay sample rates at `0` ([#PR_NUMBER](https://github.com/getsentry/sentry-react-native/pull/PR_NUMBER)) +- Apply `Sentry.Mask` and `Sentry.Unmask` on iOS when you start a replay manually with both replay sample rates at `0` ([#7008](https://github.com/getsentry/sentry-react-native/pull/7008)) ### Dependencies