Skip to content

Initialize native SDKs before JS #3608

@krystofwoldrich

Description

@krystofwoldrich

Available in https://github.com/getsentry/sentry-react-native/releases/tag/6.7.0-alpha.0

Create sentry.options.json in the React Native project root and set options the same as you currently have in Sentry.init in JS.

{
    "dsn": "https://[email protected]/value",
}

Initialize Sentry on the native layers by newly provided native methods.

import io.sentry.react.RNSentrySDK

class MainApplication : Application(), ReactApplication {
    override fun onCreate() {
        super.onCreate()
        RNSentrySDK.init(this)
    }
}
#import <RNSentry/RNSentry.h>

@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [RNSentrySDK start];
    return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end

Development

Tasks

  • Create RNSentry.init for Android
  • Create RNSentry.init for Cocoa
  • Update @sentry/wizard to optionally use sentry.options.json
  • Add new manual init docs
  • Add JSON file schema
  • Add E2E tests using manual init
  • Update Sample App to use manual init by default

Native RNSentry.init tasks

Sub-issues

Metadata

Metadata

Assignees

Projects

Status

Backlog

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions