feat: Handle wrapped onPress event in DdEventsInterceptor for react-native-ui-lib compatibility#1157
Open
jhssilva wants to merge 1 commit intoDataDog:developfrom
Open
Conversation
Some third-party libraries (e.g. react-native-ui-lib) change the onPress
callback signature by wrapping the native GestureResponderEvent inside a
props object: onPress({...componentProps, event: GestureResponderEvent}).
The SDK checks args[0]._targetInst to identify the tapped element, which
only exists on the native event — not on the wrapper object — causing
actions to be silently dropped.
This adds a fallback in DdEventsInterceptor.interceptOnPress that checks
args[0].event._targetInst when args[0]._targetInst is not present,
allowing the SDK to extract the native event from the wrapper.
cdn34dd
approved these changes
Feb 23, 2026
Contributor
cdn34dd
left a comment
There was a problem hiding this comment.
Looks good, also open one for feature/v2.
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?
DdEventsInterceptor.interceptOnPressto handle third-party libraries that wrap the nativeGestureResponderEventinside a props object (e.g.react-native-ui-libpasses{...componentProps, event: GestureResponderEvent}instead of the raw event)args[0]._targetInstis not found (standard RN path), the interceptor now checksargs[0].event._targetInstbefore dropping the actionMotivation
react-native-ui-lib's TouchableOpacity wraps the native GestureResponderEvent inside a props object before passing it to onPress, causing the args[0]._targetInst check to fail and RUM actions to be silently droppedargs[0]_targetInst?TouchableOpacityGestureResponderEventreact-native-ui-lib(main){...props, event: GestureResponderEvent}.eventreact-native-ui-lib(Incubator)props(no event at all)Note: The Incubator variant remains unsupported — it uses react-native-gesture-handler's
TapGestureHandlerwhich never produces aGestureResponderEvent, so there is no native event to extract.Review checklist (to be filled by reviewers)