RUM-18048: Fix Fabric text mapping in minified Android builds - #1369
Open
jonathanmos wants to merge 1 commit into
Open
RUM-18048: Fix Fabric text mapping in minified Android builds#1369jonathanmos wants to merge 1 commit into
jonathanmos wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Session Replay styled-text extraction for React Native new architecture on Android when apps are minified (R8), by removing reliance on reflective access to a private React Native field and switching to a supported accessor.
Changes:
- Replaces reflective lookup of React Native’s internal
mSpannedfield withReactTextView.spannedfor Fabric text color extraction. - Simplifies
FabricTextViewUtilsby removing logger-based warning telemetry tied to the old reflection path. - Updates unit tests to mock
ReactTextView.spanneddirectly instead of stubbing the reflection helper.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/react-native-session-replay/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/utils/text/TextViewUtilsTest.kt | Adjusts Fabric-specific test to provide ReactTextView.spanned and remove reflection stubbing. |
| packages/react-native-session-replay/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/utils/text/TextViewUtils.kt | Updates the new-architecture factory path to construct FabricTextViewUtils without a logger. |
| packages/react-native-session-replay/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/utils/text/FabricTextViewUtils.kt | Switches styled-text span extraction to use ReactTextView.spanned and removes reflection + warning logging. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Fixes Session Replay text handling in minified Android builds using React Native’s new architecture.
R8 can rename an internal React Native text field, causing Session Replay to fail when reading styled text and generate repeated telemetry warnings. This change uses React Native’s supported accessor instead.
Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)