You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FIX] Support Android prepared text layouts in Session Replay - #1574
Adds Session Replay support for Android’s PreparedLayoutTextView, including text content, styling, alignment, padding, truncation, and existing text privacy rules.
The mapper is registered only when the class is available, preserving compatibility with older React Native versions. Includes ProGuard rules and regression tests for mapping, privacy, registration, and reflection failures.
Motivation
React Native 0.89 enables a new text renderer whose views extend ViewGroup rather than TextView. Existing Session Replay text mappers do not handle this class, causing text to disappear from recordings.
Review checklist (to be filled by reviewers)
Feature or bugfix MUST have appropriate tests
Make sure you discussed the feature or bugfix with the maintaining team in an Issue
Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
If this PR is auto-generated, please make sure also to manually update the code related to the change
The reason will be displayed to describe this comment to others. Learn more.
Two distinct correctness issues exist in PreparedLayoutTextViewMapper: span-level font sizes (AbsoluteSizeSpan) are not resolved before using the layout paint's base text size, and view.alpha is silently dropped when no background drawable is present, causing text to render fully opaque in session replay.
The reason will be displayed to describe this comment to others. Learn more.
More details
The PR adds Android Session Replay support for prepared text views, preserving optional registration and existing privacy rules. The latest commit fixes both reported defects: span-level font sizes and opacity without a background. It also adds regression coverage and stabilizes the registration test. No findings remain open, and the incremental review identified no new issues. Native Android tests remain unexecuted because required dependencies and the SDK are unavailable.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The tests do not validate the reflection contract against a real React Native 0.89 PreparedLayoutTextView, so incorrect class names or accessor signatures could silently omit prepared text from recordings.
The tests do not verify the reflection contract with React Native: registration injects ViewGroup::class.java or null, and the reader uses hand-written fake classes. A wrong class name or accessor signature would therefore go undetected and leave prepared text absent from recordings. Add an RN 0.89 compatibility test that uses the default resolver and reads a real, laid-out PreparedLayoutTextView.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
RN 0.89 Android runtime and R8-minified release validation are still needed because the dependency-free RN 0.76.9 checkout cannot verify the reflective internal APIs or shrinker contracts.
Prepared-layout text is recorded on Android only when PreparedLayoutTextView is on the classpath, and the span size, opacity, ellipsized text, font family, padding, and privacy behavior match the existing React text mappers and React Native 0.89's draw path. This is ready to merge as-is. Quality stays 5.0 after the span-size, opacity, and accessor-test updates.
Customer impact:Medium — Android Session Replay on React Native versions that render Text with PreparedLayoutTextView records that text under the existing text privacy modes. iOS and apps with Session Replay disabled are unaffected.
Concern
Prepared-layout text wireframe mapping (content, style, alignment, padding, truncation, privacy)
Risky
Optional registration, reflective access, and ProGuard keep rules
Risky
Assessment:capturedText uses layout.text, then the same privacy switch as TextViewMapper.resolveCapturedText. Color, font family, and size are read from sourceText, which is the spannable React Native keeps beside the ellipsized layout. fontSize() follows LegacyTextViewUtils.resolveTextSize (AbsoluteSizeSpan, DIP as-is, pixels divided by density, otherwise the layout paint). With no resolved background, shapeStyle carries view.alpha on a transparent fill, which is the opacity slot DefaultMapper already uses. Padding uses paddingLeft / paddingTop plus verticalOffset, matching onDraw. Registration stays off when the class is missing, reflected reads fail closed to a background wireframe, and the ProGuard keeps match getPreparedLayout, getText, getLayout, and getVerticalOffset. The RN 0.89 reader test constructs the real PreparedLayout and is skipped on this repo's 0.76 classpath.
Review load — Broad (~1–1.5h): The effort is the mapping contract against ReactTextMapper / TextViewMapper and the reflective registration/ProGuard path. Those belong in one review; they fail independently but ship as one Android mapper.
This run reviewed the full current diff and revalidated the prior findings. The font-family and captured-text comments (font family, captured text) stay fixed.
Sent by Cursor Automation: dd-sdk-react-native reviews
- Add PreparedLayoutTextViewMapper and PreparedTextLayoutReader.
- Register the mapper when the RN class is available.
- Include ProGuard rules and the mapper, reader, and registration tests
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The density clamp incorrectly replaces valid values below 1, causing text and padding to render too small relative to wireframe bounds on ldpi Android devices.
The reason will be displayed to describe this comment to others. Learn more.
More details
The static specialist reported no actionable defects. Android runtime behavior remains unverified because the checkout lacks the React Native dependencies and Android SDK needed to execute native tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds Session Replay support for Android’s PreparedLayoutTextView, including text content, styling, alignment, padding, truncation, and existing text privacy rules.
The mapper is registered only when the class is available, preserving compatibility with older React Native versions. Includes ProGuard rules and regression tests for mapping, privacy, registration, and reflection failures.
Motivation
React Native 0.89 enables a new text renderer whose views extend ViewGroup rather than TextView. Existing Session Replay text mappers do not handle this class, causing text to disappear from recordings.
Review checklist (to be filled by reviewers)