Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ sidebar_order: 50
description: "Learn how to capture app start errors and crashes that occur before JavaScript loads using native initialization."
---

<Alert level="warning" title="Beta Testing">

Sentry React Native SDK v8 is currently in beta testing. This feature is available for early adopters and may undergo changes before the stable release.

</Alert>

By default, the React Native SDK initializes the native SDK underneath the `init` method called on the JS layer. As a result, the SDK has a current limitation of not capturing native crashes that occur prior to the `init` method being called on the JS layer.

Starting with SDK version 8.0.0, you can initialize Sentry natively before JavaScript loads, enabling capture of app start errors and crashes that occur during:
Expand Down Expand Up @@ -50,7 +44,7 @@ Options from `sentry.options.json` are merged with options from `Sentry.init()`

Initialize Sentry in your `MainApplication` class:

```kotlin {filename:android/app/src/main/java/.../MainApplication.kt}
```kotlin {tabTitle:Kotlin,filename:android/app/src/main/java/.../MainApplication.kt}
import io.sentry.react.RNSentrySDK

class MainApplication : Application(), ReactApplication {
Expand All @@ -62,11 +56,24 @@ class MainApplication : Application(), ReactApplication {
}
```

```java {tabTitle:Java,filename:android/app/src/main/java/.../MainApplication.java}
import io.sentry.react.RNSentrySDK;

public class MainApplication extends Application implements ReactApplication {
@Override
public void onCreate() {
super.onCreate();
RNSentrySDK.init(this);
// ... rest of your initialization code
}
}
```

## iOS Setup

Initialize Sentry in your `AppDelegate`:
Initialize Sentry in your `AppDelegate` before starting React Native so app start crashes are captured.

```objective-c {filename:ios/YourApp/AppDelegate.mm}
```objective-c {tabTitle:Objective-C,filename:ios/YourApp/AppDelegate.mm}
#import <RNSentry/RNSentry.h>

@implementation AppDelegate
Expand All @@ -81,6 +88,23 @@ Initialize Sentry in your `AppDelegate`:
@end
```

```swift {tabTitle:Swift,filename:ios/YourApp/AppDelegate.swift}
import RNSentry

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
RNSentrySDK.start()
// ... rest of your initialization code
return true
}
}
```

## Expo Setup

If you're using Expo, you can enable native initialization automatically using the Expo plugin:
Expand Down
15 changes: 8 additions & 7 deletions docs/platforms/react-native/migration/v7-to-v8.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ sidebar_order: 98
description: "Learn how to migrate from version 7 to version 8 of the Sentry React Native SDK"
---

<Alert level="warning">

**Version 8 is currently in beta.** This migration guide is provided for early adopters. The API and features may change before the stable release.

</Alert>

Version 8 of the Sentry React Native SDK updates the underlying native SDKs (Cocoa v9, CLI v3, Android Gradle Plugin v6) which introduce breaking changes in minimum version requirements and build tooling.

## Important Changes in Dependencies
Expand All @@ -33,8 +27,15 @@ The minimum supported versions have been updated:
- **iOS**: **15.0+** (previously 11.0+)
- **macOS**: **10.14+** (previously 10.13+)
- **tvOS**: **15.0+** (previously 11.0+)
- **Xcode**: **16.4+** (required)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some context for this addition at getsentry/sentry-react-native#5652 (comment)


If your app targets older versions, you'll need to update your deployment targets before upgrading to version 8.

**Note:** Xcode 16.4+ is required for proper Swift module compilation. Using older versions may result in build errors. Ensure your CI/CD environment uses Xcode 16.4 or later.

If you have custom `post_install` hooks in your `Podfile` that modify `SWIFT_VERSION` or other Swift compiler flags for all pods, exclude Sentry targets to avoid conflicts.

If your app targets older versions, you'll need to update your deployment targets before upgrading to version 8. For more details on the Cocoa SDK v9 changes, see the [Cocoa SDK 8.x to 9.x migration guide](/platforms/apple/migration/#migrating-from-8x-to-9x).
For more details on the Cocoa SDK v9 changes, see the [Cocoa SDK 8.x to 9.x migration guide](/platforms/apple/migration/#migrating-from-8x-to-9x).

#### Android

Expand Down