Migrate from 6.x to 7.x

Learn how to migrate from version 6 to version 7 of the Sentry React Native SDK

The main goal of version 7 of the Sentry React Native SDK is to provide compatibility with Sentry JavaScript version 9. This update includes breaking changes due to the upgrade to JavaScript SDK v9, the removal of deprecated APIs, and a reorganization of the npm package structure.

The Sentry React Native SDK ships with the Sentry JavaScript SDK Version 9 as a dependency. This version includes a number of behavioral changes that will not be caught by type checkers, linters, or tests, so we recommend carefully reading through the entire migration guide instead of relying on automatic tooling. Please follow the JavaScript migration guides to complete the upgrade.

The initial @sentry/react-native@7.0.0 ships with @sentry/core@9.1.0. Always use the exact JavaScript SDK version if adding it manually to your project. Any other version might not be compatible with the React Native SDK.

Version 7 also includes a major upgrade to the Android SDK dependency, introducing behavioral changes, breaking changes, and deprecations. If you are using the Android SDK directly, please follow the Android SDK version 8 migration guide.

Other general JavaScript SDK version 9 changes are described in the JavaScript SDK 8.x to 9.x migration guide.

Beginning with version 7.0.0, the Sentry Capacitor SDK will only support self-hosted Sentry instances version 25.2.0 and above. This change does not affect users of sentry.io.

This section describes API changes in the Sentry React Native SDK, version 7.

You can use the updated snippet in order to capture user Feedback:

Copied
+ import { captureFeedback } from '@sentry/react-native';
- import { captureUserFeedback } from '@sentry/react-native';

+ captureUserFeedback({
- captureFeedback({
    name: 'my name',
    email: 'myemail@sentry.io',
    message: 'it broke',
    associatedEventId: 'eventID',
  });

Additionally you can also see our new Feedback integration by checking the User Feedback Configuration guide

Option key autoSessionTracking was removed. Use enableAutoSessionTracking instead, enabled by default.

Copied
Sentry.init({
+  enableAutoSessionTracking: true,
-  autoSessionTracking: true,
});

The check is now done inside of the integration, simplifying workflows.

Copied
Sentry.init({
+  integrations: [ Sentry.browserReplayIntegration() ],
-  integrations: (defaultIntegrations) => {
-    if (Platform.OS === 'web') {
-      defaultIntegrations.push(Sentry.browserReplayIntegration());
-    }
-    return defaultIntegrations;
-  },
});

The App word was removed from the span description. If you have any logic in your application or in Sentry based on this span description, please, make sure to update.

Starting with version 7.0.0, the Sentry React Native SDK will use the ExpoGo module to detect if the application is running on Expo Go. This differs from the previous behavior, where the SDK would check for the deprecated appOwnership property. This new approach doesn't work for Expo SDK 49 and older. The minimum supported Expo SDK version is 50, same as in Sentry React Native SDK v6.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").