Skip to content

Commit fa6bc25

Browse files
feat(react-native): Add ignoredComponents option (#12684)
Co-authored-by: Alex Krawiec <[email protected]>
1 parent a4fe416 commit fa6bc25

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/platforms/react-native/integrations/component-names.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,34 @@ Here's what the resulting node would look like if your bundler had applied the p
7171

7272
The Sentry browser SDK will pick off the value from these `data` attributes and collect them when your components are interacted with.
7373

74+
## Options
75+
76+
By default only components located in your project (outside of `node_modules`) are annotated. To avoid annotating other components, use the `ignoredComponents` option. The ignored components won't have `data-sentry-*` annotations added.
77+
78+
```javascript {tabTitle:React Native} {filename:metro.config.js}
79+
const { getDefaultConfig } = require("@react-native/metro-config");
80+
const { withSentryConfig } = require('@sentry/react-native/metro');
81+
82+
const config = getDefaultConfig(__dirname);
83+
module.exports = withSentryConfig(config, {
84+
annotateReactComponents: {
85+
ignoredComponents: ['MyCustomComponent']
86+
}
87+
});
88+
```
89+
90+
```javascript {tabTitle:Expo} {filename:metro.config.js}
91+
// const { getDefaultConfig } = require("expo/metro-config");
92+
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
93+
94+
// const config = getDefaultConfig(__dirname);
95+
const config = getSentryExpoConfig(__dirname, {
96+
annotateReactComponents: {
97+
ignoredComponents: ['MyCustomComponent']
98+
}
99+
});
100+
```
101+
74102
## Troubleshooting
75103

76104
### Missing Component Names

0 commit comments

Comments
 (0)