Taps on a `Pressable` with more than one child are not tracked
Maintainer thường phản hồi trong vòng 2 ngày
@cdn34dd đang làm issue này rồi.
Từ ngày 21/10/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, react-native, typescript
Hướng nghiên cứu
Start by reading the startTracking and stopTracking code mentioned in the report, then inspect the JSX runtime interception and related unit tests for interceptOnPress. Reproduce with a release or dev=false bundle using a Pressable with multiple children, and compare its behavior with the one-child case. Done when taps on both named and unnamed multi-child Pressable components produce RUM actions and the tests cover the behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Taps on a React Native Pressable with more than one child are not reported to RUM. The handler of the app runs, but the SDK adds no action. This happens with and without dd-action-name, in a bundle with __DEV__ === false.
We found it while naming our taps. Many taps were reported as RCTView, so we added dd-action-name to our buttons. It worked for most of them. On some buttons the name never showed up, and the tap was not in RUM at all, even though the button worked in the app.
In our tests with the buttons below:
- A
Pressablewith one child: tap reported. - A
Pressablewith more than one child: no tap reported. - A
Pressablewith more than one child inside a parent that receivesonPressand passes it down: tap reported.
A TouchableOpacity with more than one child was fine in our tests.
We suspect it has to do with jsxs. Babel uses it for elements with more than one child, and startTracking replaces only jsx. We did not verify this on a device. Only on an emulator.
Reproduction steps
- Use a bundle with
__DEV__ === false(a release build, or Metro withdev=false). SetverbositytoDEBUG. - Render this and tap each button once, in order:
import { Pressable, Text } from 'react-native'
const Owner = ({ onPress, name }: { onPress: () => void; name?: string }) => (
<Pressable onPress={onPress} dd-action-name={name}>
<Text>Two children</Text>
<Text>Second child</Text>
</Pressable>
)
export const Repro = () => (
<>
<Pressable onPress={() => console.log('DUMMY handler ran: A named, one child')} dd-action-name="Dummy A named, one child">
<Text>A</Text>
</Pressable>
<Pressable onPress={() => console.log('DUMMY handler ran: B named, two children')} dd-action-name="Dummy B named, two children">
<Text>B</Text>
<Text>Second child</Text>
</Pressable>
<Owner onPress={() => console.log('DUMMY handler ran: C named, owner passes onPress')} name="Dummy C named, owner passes onPress" />
<Pressable onPress={() => console.log('DUMMY handler ran: D unnamed, one child')}>
<Text>D</Text>
</Pressable>
<Pressable onPress={() => console.log('DUMMY handler ran: E unnamed, two children')}>
<Text>E</Text>
<Text>Second child</Text>
</Pressable>
<Owner onPress={() => console.log('DUMMY handler ran: F unnamed, owner passes onPress')} />
</>
)
Here is a recording of that test:
https://github.com/user-attachments/assets/6f903af7-56e1-4947-81b0-9e9ebc32c57a
SDK logs
Output of the component above in our app, one tap per button, in order. Both "two children" buttons (B and E) have no Adding RUM Action line.
DUMMY handler ran: A named, one child
DATADOG: Adding RUM Action "Dummy A named, one child" (TAP)
DUMMY handler ran: B named, two children
DUMMY handler ran: C named, owner passes onPress
DATADOG: Adding RUM Action "Dummy C named, owner passes onPress" (TAP)
DUMMY handler ran: D unnamed, one child
DATADOG: Adding RUM Action "RCTView" (TAP)
DUMMY handler ran: E unnamed, two children
DUMMY handler ran: F unnamed, owner passes onPress
DATADOG: Adding RUM Action "RCTView" (TAP)
"Owner passes onPress" means a parent component with one child receives onPress and passes the same function to the Pressable with two children.
Expected behavior
A RUM tap action for every Pressable with a handler, as for the one-child case.
We added jsxs next to jsx in a local patch. With the patch, the taps on the Pressable with more than one child are reported in the iOS simulator, and interceptOnPress runs in a unit test with a component that reads props.onPress. Not saying this is the right fix.
const originalJsx = jsxRuntime?.jsx;
+const originalJsxs = jsxRuntime?.jsxs;
...
+if (originalJsxs) {
+ jsxRuntime.jsxs = (...args) => this.patchCreateElementFunction(originalJsxs, args);
+}
stopTracking restores jsxs like jsx.
Affected SDK versions
2.14.9 (tested). The source of 3.10.0 has the same code in startTracking; we did not run 3.10.0.
Latest working SDK version
Unknown. We did not test other versions.
Did you confirm if the latest SDK version fixes the bug?
No
Integration Methods
Yarn
React Native Version
0.81.5
Package.json Contents
"@datadog/mobile-react-native": "^2.x",
"@datadog/mobile-react-navigation": "^2.x",
"expo": "^54.x",
"react": "19.1.0",
"react-native": "0.81.5"
iOS Setup
Podfile.lock has DatadogCore, DatadogInternal, DatadogLogs, DatadogRUM, DatadogTrace, DatadogWebViewTracking, DatadogCrashReporting 2.30.2 and DatadogSDKReactNative 2.14.9. Tested in the iOS simulator only.
Android Setup
com.datadoghq.dd-sdk-android-gradle-plugin 1.21.0, hermesEnabled=true, newArchEnabled=false. The native Datadog libraries (dd-sdk-android-rum, -logs, -trace, -webview) come from the React Native SDK at 2.26.2. We did not test on Android. The issues are in JavaScript, so we expect the same there.
Device Information
No response
Other relevant information
No response
- Ngôn ngữ chính
- TypeScript
- Star
- 146
- Fork
- 67
- Merge trung bình
- 2 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DataDog/dd-sdk-reactnative
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
DataDog/dd-sdk-reactnative#1509 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[actionNameAttribute] prop doesn't accept value with curly bracesCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
DataDog/dd-sdk-reactnative#1486 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Expose Android app startup Activity filtering in the React Native SDKCó thể đã có người làm @sbarrio đã nhận 13 ngày trước. Đang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
DataDog/dd-sdk-reactnative#1485 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
GraphQL variables with non-ASCII contents will make Apollo Client request throw errorCó thể đã có người làm @cdn34dd đã nhận 15 ngày trước. Đang mởawaiting response bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
DataDog/dd-sdk-reactnative#1482 · 2 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Interaction tracking records nothing: the babel plugin's injected import makes Metro bundle a second copy of the SDK, so DdBabelInteractionTracking.config is set on a different class than instrumented handlers callCó thể đã có người làm @cdn34dd đã nhận 13 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
DataDog/dd-sdk-reactnative#1377 · 1 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của DataDog/dd-sdk-reactnative
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
logto-io/logto#9837 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
lingdojo/kana-dojo#32964 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Documentation status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mastra-ai/mastra#28194 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority-low refactor-3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 3 ngày