Skip to content

feat(react-native): add maskTestIDs and unmaskTestIDs masking options#528

Merged
beekld merged 6 commits into
mainfrom
beeklimt/O11Y-1398-2
May 6, 2026
Merged

feat(react-native): add maskTestIDs and unmaskTestIDs masking options#528
beekld merged 6 commits into
mainfrom
beeklimt/O11Y-1398-2

Conversation

@beekld
Copy link
Copy Markdown
Contributor

@beekld beekld commented May 5, 2026

Summary

  • Adds maskTestIDs and unmaskTestIDs to the React Native session replay options. RN's testID prop is the natural way to identify specific views from JS for masking config.
    • These options are passed to iOS (maskAccessibilityIdentifiers / unmaskAccessibilityIdentifiers) and Android (maskXMLViewIds / unmaskXMLViewIds).
  • Fixes iOS maskLabels for React Native apps, by including its UILabel alternatives.
  • Adds a MaskingScreen in the example app for manual verification.
  • Fixes the .env mobile-key setup (via react-native-dotenv) to work as it was already documented.

How did you test this change?

Tested using the example app and capturing a session replay. Everything works as expected in both Android and iOS

App

Screenshot 2026-05-05 at 10 14 39 PM

Session Replay

Screenshot 2026-05-05 at 10 15 18 PM

Are there any deployment considerations?

N/A


Note

Medium Risk
Changes session replay privacy/masking behavior and underlying native option mapping on both iOS and Android, which could affect what user data is captured or redacted if misconfigured. Also bumps the Android observability dependency, so behavior may shift with upstream SDK changes.

Overview
Adds maskTestIDs and unmaskTestIDs to the React Native session replay options and wires them through the native bridges (Android maps to PrivacyProfile.maskXMLViewIds/unmaskXMLViewIds; iOS maps to accessibility identifier masking and combines new keys with the deprecated *AccessibilityIdentifiers lists).

Fixes iOS maskLabels for React Native by including RN text view classes in maskUIViews when enabled. Updates the example app to demonstrate/verify testID-based masking (new MaskingScreen, simple tab UI) and fixes .env key injection via react-native-dotenv. Also bumps launchdarkly-observability-android from 0.42.0 to 0.45.0.

Reviewed by Cursor Bugbot for commit 486e5cb. Bugbot is set up for automated code reviews on this repo. Configure here.

@beekld beekld force-pushed the beeklimt/O11Y-1398-2 branch from f3d2270 to edd5f08 Compare May 5, 2026 22:37
beekld added a commit that referenced this pull request May 5, 2026
…eplay masking (#527)

## Summary

Two related fixes to the Android session replay SDK to make masking work
correctly with React Native views:
1. `maskXMLViewIds` and `unmaskXMLViewIds` now also match the value of
the `react_test_id` tag (RN's `testID` prop) when the React Native
library is on the runtime classpath. Resolved reflectively so the SDK
has no compile-time RN dependency.
3. `maskImageViews` now catches ImageView subclasses (notably RN's
`ReactImageView`) instead of only the exact `android.widget.ImageView`
class.

## How did you test this change?

Tested with PR #528 using the example app and capturing a session
replay.

## Are there any deployment considerations?

N/A

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Updates session replay masking matchers, which can change what UI is
captured vs masked (privacy-sensitive) and could cause
over/under-masking in apps, especially with mixed native/RN view
hierarchies.
> 
> **Overview**
> Improves `PrivacyProfile` masking to work with React Native-rendered
views by having `maskXMLViewIds`/`unmaskXMLViewIds` also match RN’s
`testID` via the `react_test_id` view tag (resolved reflectively to
avoid an RN dependency).
> 
> Updates `maskImageViews` to mask *all* `ImageView` instances
(including subclasses) by introducing an `imageViewMatcher` instead of
relying on exact-class matching, and refreshes docs/tests to reflect the
new behavior.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
65f2af5. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@beekld beekld force-pushed the beeklimt/O11Y-1398-2 branch from edd5f08 to 752772e Compare May 6, 2026 01:30
@beekld beekld marked this pull request as ready for review May 6, 2026 04:28
@beekld beekld requested a review from a team as a code owner May 6, 2026 04:28
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4d16967. Configure here.

@beekld beekld merged commit 3d33328 into main May 6, 2026
23 checks passed
@beekld beekld deleted the beeklimt/O11Y-1398-2 branch May 6, 2026 17:06
Vadman97 pushed a commit that referenced this pull request May 6, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>session-replay-react-native: 0.9.0</summary>

##
[0.9.0](session-replay-react-native-0.8.0...session-replay-react-native-0.9.0)
(2026-05-06)


### Features

* **react-native:** add maskTestIDs and unmaskTestIDs masking options
([#528](#528))
([3d33328](3d33328))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk release bookkeeping only: version/manifest bumps and a
changelog entry, with no functional code changes in this diff.
> 
> **Overview**
> Updates the Release Please manifest and
`@launchdarkly/session-replay-react-native` package version from `0.8.0`
to `0.9.0`.
> 
> Adds the `0.9.0` changelog entry noting new React Native masking
options (`maskTestIDs`/`unmaskTestIDs`).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3fa7b73. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants