diff --git a/docs/platforms/react-native/configuration/options.mdx b/docs/platforms/react-native/configuration/options.mdx index 425373f7decf5..8c76dad28d0e1 100644 --- a/docs/platforms/react-native/configuration/options.mdx +++ b/docs/platforms/react-native/configuration/options.mdx @@ -153,6 +153,23 @@ _(New in version 4.11.0)_ + + +Configures masking for error screenshots. When `attachScreenshot` is enabled, these options control what gets masked in the captured screenshot. Both `maskAllText` and `maskAllImages` default to `true`. You can also specify native view classes to mask or unmask using `maskedViewClasses` and `unmaskedViewClasses`. + +```javascript +screenshot: { + maskAllText: true, + maskAllImages: true, + maskedViewClasses: ["MKMapView"], + unmaskedViewClasses: ["MyCustomSafeView"], +} +``` + +Learn more in our Screenshots documentation. + + + Renders a JSON representation of the entire view hierarchy of the application when an error happens and includes it as an attachment. diff --git a/platform-includes/enriching-events/attach-screenshots/react-native.mdx b/platform-includes/enriching-events/attach-screenshots/react-native.mdx index fa89b768c6a38..a1925da93abbc 100644 --- a/platform-includes/enriching-events/attach-screenshots/react-native.mdx +++ b/platform-includes/enriching-events/attach-screenshots/react-native.mdx @@ -6,3 +6,31 @@ Sentry.init({ attachScreenshot: true, }); ``` + +### Screenshot Masking + +You can configure masking to automatically redact sensitive content like text and images from error screenshots. Masking is enabled by default. + +```javascript +Sentry.init({ + dsn: "___PUBLIC_DSN___", + attachScreenshot: true, + screenshot: { + maskAllText: true, // default: true + maskAllImages: true, // default: true + }, +}); +``` + +You can also mask or unmask specific native view classes. This is useful for views from third-party native libraries (for example, map views or payment forms): + +```javascript +Sentry.init({ + dsn: "___PUBLIC_DSN___", + attachScreenshot: true, + screenshot: { + maskedViewClasses: ["MKMapView"], // iOS class name + unmaskedViewClasses: ["MyCustomSafeView"], + }, +}); +```