From d643fccfc11f3ed1cc5d3317dadcf78ae7e1a4bd Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 10 Mar 2026 16:16:42 +0100 Subject: [PATCH] feat(react-native): Add environment option to Expo config plugin --- .../manual-setup/app-start-error-capture.mdx | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/platforms/react-native/manual-setup/app-start-error-capture.mdx b/docs/platforms/react-native/manual-setup/app-start-error-capture.mdx index 0b7004aad70c84..9c63a9a519cc51 100644 --- a/docs/platforms/react-native/manual-setup/app-start-error-capture.mdx +++ b/docs/platforms/react-native/manual-setup/app-start-error-capture.mdx @@ -139,3 +139,40 @@ export default withSentry(config, { When `useNativeInit` is set to `true`, the Expo plugin automatically: - Adds `RNSentrySDK.init()` to your Android `MainApplication` - Adds `RNSentrySDK.start()` to your iOS `AppDelegate` + +### Setting the Environment + +You can set the `environment` for native initialization using the Expo plugin prop or the `SENTRY_ENVIRONMENT` environment variable. The plugin writes the value into `sentry.options.json` during `expo prebuild`. + +```json {filename:app.json} +{ + "expo": { + "plugins": [ + [ + "@sentry/react-native/expo", + { + "useNativeInit": true, + "environment": "staging" + } + ] + ] + } +} +``` + +For per-environment builds with EAS Build, set `SENTRY_ENVIRONMENT` in your build profiles instead: + +```json {filename:eas.json} +{ + "build": { + "production": { + "env": { "SENTRY_ENVIRONMENT": "production" } + }, + "staging": { + "env": { "SENTRY_ENVIRONMENT": "staging" } + } + } +} +``` + +The plugin prop takes precedence over the environment variable.