Skip to content

[FIX] Automatic interaction tracking on React Native 0.89 - #1575

Open
cdn34dd wants to merge 1 commit into
carlosnogueira/fix/support-prepare-text-layouts-srfrom
carlosnogueira/fix/interaction-tracking-rn-0.89
Open

cdn34dd wants to merge 1 commit into
carlosnogueira/fix/support-prepare-text-layouts-srfrom
carlosnogueira/fix/interaction-tracking-rn-0.89

Conversation

@cdn34dd

@cdn34dd cdn34dd commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Restores automatic tap tracking on React Native 0.89 for iOS and Android. When _targetInst is unavailable, the interceptor resolves the React instance from currentTarget, then target, while preserving support for older event formats.

Includes regression tests for direct and wrapped events, immutable events, and action label resolution.

Motivation

React Native 0.89 touch events no longer expose _targetInst. The interceptor consequently discards these events, leaving automatic RUM tap actions unrecorded.

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

@cdn34dd
cdn34dd added this pull request to stack #1576 November 20, 2026 16:42
@cdn34dd cdn34dd changed the title Fix automatic interaction tracking on React Native 0.89 [FIX] Automatic interaction tracking on React Native 0.89 Nov 20, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PR Review — Quality: 5.0 / 5 · Review load: Focused (~30–45min)

This restores automatic RUM taps for the runtime onPress interceptor on React Native 0.89, and it is ready to merge as-is. resolveTargetNode still prefers _targetInst, then the fiber on currentTarget.__internalInstanceHandle, then target.__internalInstanceHandle. That matches 0.89 EventTarget dispatch (enableNativeEventTargetEventDispatching defaults on in 0.89.0-rc.2): those press events do not carry _targetInst, currentTarget is the pressed host while onPress runs, and nativeEvent is unchanged, so touch coordinates still go through touchDataFromEvent. Events that still have _targetInst, including older runtimes, keep the previous fiber.

Customer impact: Medium — React Native 0.89 apps that set trackInteractions and do not use the Babel plugin record tap actions again. Babel interaction tracking names actions from compile-time props and does not use this resolver. trackInteractions stays off by default.

Concern
Tap qualification and fiber selection in DdEventsInterceptor Risky

Assessment: The helper is private, the new reads use optional chaining, and nothing is exported from the public entry point. Tests cover a fiber on target or currentTarget with no _targetInst, _targetInst winning when both shapes are present, a wrapped { event } press, a frozen event that must not gain _targetInst, and the pressed host’s accessibility label winning over a nested text target. When both fibers exist, the name comes from the pressed host; that is the order the description and the nested-text test lock in.

Review load — Focused (~30–45min): One cross-runtime choice: which object counts as a press, and which fiber names it. iOS and Android share this JS path.

Open in Web View Automation 

Sent by Cursor Automation: dd-sdk-react-native reviews

@cdn34dd
cdn34dd force-pushed the carlosnogueira/fix/interaction-tracking-rn-0.89 branch 2 times, most recently from 886230c to 866e2a8 Compare November 24, 2026 14:41
- Update DdEventsInterceptor to handle the new event shape while
preserving legacy support
- Include the interceptor tests
@cdn34dd
cdn34dd force-pushed the carlosnogueira/fix/interaction-tracking-rn-0.89 branch from 866e2a8 to bbdefb3 Compare November 24, 2026 14:53
@cdn34dd
cdn34dd marked this pull request as ready for review November 24, 2026 16:17
@cdn34dd
cdn34dd requested a review from a team as a code owner November 24, 2026 16:17
Copilot AI balanced review requested due to automatic review settings November 24, 2026 16:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T16:18:25.903116Z bbdefb3 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-24T16:20:19.252011Z bbdefb3 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The fix relies on private React Native 0.89 EventTarget/Fiber fields, but tests use hand-built RN 0.76.9 objects, leaving real iOS and Android presses, action labels, and native touch data unverified.

No open issues 🎉

What changed in this PR

This PR updates automatic tap tracking for React Native 0.89 events that lack _targetInst, while preserving support for older event formats.

Changes:

  • Resolves the React instance from _targetInst, then currentTarget, then target.
  • Supports direct and wrapped events without modifying the original event.
  • Adds regression tests for immutable events, target precedence, and action-label resolution.
File Description
packages/​core/​src/​rum/​instrumentation/​interactionTracking/​DdEventsInterceptor.tsx Adds shared target resolution for legacy and EventTarget-based events.
packages/​core/​src/​__tests__/​rum/​instrumentation/​DdEventsInterceptor.test.tsx Tests new event formats, event preservation, target precedence, and naming.

Review effort: Balanced

@datadog-prod-us1-5 datadog-prod-us1-5 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

Legacy target precedence is preserved, and the fallback handles immutable and wrapped events. React Native 0.89 device behavior remains unverified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit bbdefb3

This branch has not been deployed

No deployments
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