feat(core): Enable autoInjectSentryLabel by default in Metro config#6141
Merged
Conversation
Pass `autoInjectSentryLabel: true` to the babel-plugin-component-annotate plugin by default when `annotateReactComponents` is enabled. This enables automatic injection of `sentry-label` props from static text content at build time, improving touch breadcrumb and user interaction span labeling. Users can opt out by setting `autoInjectSentryLabel: false` in the `annotateReactComponents` config option. Closes #6109 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c481082. Configure here.
10 tasks
This was referenced May 13, 2026
3 tasks
antonis
added a commit
to getsentry/sentry-docs
that referenced
this pull request
May 21, 2026
) ## DESCRIBE YOUR PR Documents new touch breadcrumb label features in the React Native SDK (v8.12.0): - **Automatic `sentry-label` injection** — build-time label injection from static text via the Babel plugin, enabled by default with `annotateReactComponents` ([sentry-react-native#6141](getsentry/sentry-react-native#6141)) - **Runtime text extraction from children** — `extractTextFromChildren` prop extracts text from child fiber nodes as a label fallback ([sentry-react-native#6106](getsentry/sentry-react-native#6106)) - **Session Replay masking interaction** — `sentry-label` and text extraction respect `maskAllText` and `Sentry.Mask` boundaries ([sentry-react-native#6142](getsentry/sentry-react-native#6142)) - **Updated label priority chain** — now 6 steps including text extraction and masking notes ### Files changed - `docs/platforms/react-native/configuration/touchevents.mdx` — new h2 sections for automatic label injection, text extraction, masking interaction; updated label priority; added `extractTextFromChildren` to options - `docs/platforms/react-native/integrations/component-names.mdx` — new section for `autoInjectSentryLabel` with disable examples Closes getsentry/sentry-react-native#6113 ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.) - [ ] Other deadline - [x] None: Not urgent, can wait up to 1 week+⚠️ Should be merged after the above implementation is shipped in 8.12.0 ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
📢 Type of change
📜 Description
Passes
autoInjectSentryLabel: trueto@sentry/babel-plugin-component-annotateby default whenannotateReactComponentsis enabled in the Metro config. This enables automatic injection ofsentry-labelprops from static text content at build time.The Babel plugin (shipped in
@sentry/babel-plugin-component-annotate@5.3.0, getsentry/sentry-javascript-bundler-plugins#925) extracts static text from children of touchable components and injects it as asentry-labelprop, improving touch breadcrumb and user interaction span labeling without requiring manual annotation.Users can opt out:
💡 Motivation and Context
Closes #6109. Part of the "Making breadcrumbs data more useful on React Native" project.
Currently, touch breadcrumbs show component names like "TouchableOpacity" unless developers manually add
sentry-label,accessibilityLabel, ortestIDprops. With this change, buttons like<Pressable><Text>Save workout</Text></Pressable>automatically get labeled "Save workout" in breadcrumbs and transaction names.💚 How did you test it?
yarn build— compiles without errorsnpx jest --config jest.config.tools.js test/tools/sentryBabelTransformer.test.ts— 8/8 passnpx jest --config jest.config.tools.js test/tools/metroconfig.test.ts— 142/142 passyarn lint— no violationsyarn api-report— API report up to dateautoInjectSentryLabel: falseoverrideautoInjectSentryLabel: trueis passed by default📝 Checklist
sendDefaultPIIis enabled🔮 Next steps
🤖 Generated with Claude Code