Extend @sentry/babel-plugin-component-annotate to auto-emit a sentry-label prop from static JSX text children at build time, so devs get meaningful labels without writing the prop by hand.
Example transform:
// Before
<TouchableOpacity onPress={save}>
<Text>Save workout</Text>
</TouchableOpacity>
// After (at build time)
<TouchableOpacity sentry-label="Save workout" onPress={save}>
<Text>Save workout</Text>
</TouchableOpacity>
The SDK already reads sentry-label via getLabelValue in touchevents.tsx:325 — no SDK-side change needed.
Constraints:
- Only static string literals —
<Text>{dynamicVar}</Text> gets nothing
- Skip if
sentry-label is already present (user-authored wins)
- Cap at ~64 chars
- Same plugin is used by web JS SDK — confirm no unintended side effects there
Scope: Change is in getsentry/sentry-javascript-bundler-plugins repo, not this one. Babel AST visitor addition.
Extend
@sentry/babel-plugin-component-annotateto auto-emit asentry-labelprop from static JSX text children at build time, so devs get meaningful labels without writing the prop by hand.Example transform:
The SDK already reads
sentry-labelviagetLabelValueintouchevents.tsx:325— no SDK-side change needed.Constraints:
<Text>{dynamicVar}</Text>gets nothingsentry-labelis already present (user-authored wins)Scope: Change is in
getsentry/sentry-javascript-bundler-pluginsrepo, not this one. Babel AST visitor addition.