RUMS-5681: Add support for Android heatmaps - #1341
Open
jonathanmos wants to merge 3 commits into
Open
Conversation
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 9720abc | Docs | Datadog PR Page | Give us feedback! |
jonathanmos
force-pushed
the
jmoskovich/rums-5681/rn-heatmaps
branch
4 times, most recently
from
July 21, 2026 09:40
662fe52 to
b81ec1d
Compare
jonathanmos
marked this pull request as ready for review
July 21, 2026 11:37
marco-saia-datadog
approved these changes
Jul 28, 2026
marco-saia-datadog
left a comment
Member
There was a problem hiding this comment.
LGTM 👍 Good to go as soon as we add test coverage in our E2E test matrix, so that we can verify these changes across different versions of React Native, old vs new architecture, hermes vs non-hermes etc.
marco-saia-datadog
force-pushed
the
jmoskovich/rums-5681/rn-heatmaps
branch
from
August 5, 2026 14:00
b81ec1d to
9720abc
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds Android-side heatmap support for the React Native SDK by wiring a new heatmap touch-resolution pipeline into RUM TAP actions and exposing an enableHeatmaps toggle via Session Replay enablement.
Changes:
- Add
HeatmapTouchResolver+HeatmapActionHandlerto compute and attachCrossPlatformHeatmapActionDatafor eligible TAP actions. - Propagate
enableHeatmapsinto Android Session Replay configuration and store a global heatmap-enabled flag used by RUM. - Add/extend Android unit tests to cover heatmap eligibility, fallback behavior, and resolver output; update the example app to enable Session Replay with heatmaps.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react-native-session-replay/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/DdSessionReplayImplementation.kt | Enables heatmaps in SR config and toggles the global heatmaps-enabled flag. |
| packages/react-native-session-replay/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/DdSessionReplayImplementationTest.kt | Adds tests validating enableHeatmaps propagation and global flag behavior. |
| packages/core/android/src/main/kotlin/com/datadog/reactnative/HeatmapTouchResolver.kt | New resolver that turns a React tag + coordinates into CrossPlatformHeatmapActionData. |
| packages/core/android/src/main/kotlin/com/datadog/reactnative/HeatmapActionHandler.kt | New eligibility + attachment logic that dispatches view work on the main thread and calls addActionWithHeatmap. |
| packages/core/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt | Routes TAP actions through heatmap handling, resolving the JS promise before dispatching heatmap work. |
| packages/core/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt | Wires HeatmapActionHandler/HeatmapTouchResolver using UIManagerHelper view resolution (old arch). |
| packages/core/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt | Wires HeatmapActionHandler/HeatmapTouchResolver using UIManagerHelper + ViewUtil UIManager type (new arch). |
| packages/core/android/src/test/kotlin/com/datadog/reactnative/HeatmapTouchResolverTest.kt | New unit test suite for heatmap touch resolution and element path generation. |
| packages/core/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt | Adds tests for heatmap gating, internal proxy path, fallback behavior, and promise ordering. |
| example/src/ddUtils.tsx | Removes now-inlined initialization helper. |
| example/src/App.tsx | Inlines initialization logic and enables Session Replay with enableHeatmaps: true. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+21
to
+26
| class HeatmapActionHandler internal constructor( | ||
| private val heatmapTouchResolver: HeatmapTouchResolver = HeatmapTouchResolver(), | ||
| private val mainThreadExecutor: (() -> Unit) -> Unit = { action -> | ||
| Handler(Looper.getMainLooper()).post(action) | ||
| } | ||
| ) { |
Comment on lines
+96
to
+101
| "addAction(\"$actionName\"): heatmap tracking requires actionContext's " + | ||
| "nativeEvent.target/locationX/locationY to be numbers, as produced by a " + | ||
| "standard onPress GestureResponderEvent. The value passed for this " + | ||
| "action didn't match that shape, so heatmap tracking was skipped for it " + | ||
| "— this is expected if actionContext came from a non-standard event " + | ||
| "source (e.g. a different gesture library)." |
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?
Adds heatmap support for Android RN
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)