Skip to content

How to disable Sentry when in development using Expo? #3603

Closed
@rayronvictor

Description

@rayronvictor

Description

import * as Sentry from '@sentry/react-native';

Sentry.init({
  dsn: 'YOUR DSN HERE',
  enabled: !__DEV__, // this is not working
});

function App() {
  // ...
}

registerRootComponent(Sentry.wrap(App) as Parameters<typeof registerRootComponent>[0]);

My work around is not call Sentry.init and Sentry.wrap when in development:

if (!__DEV__) {
  Sentry.init({
    dsn: 'https://[email protected]/6',
  });
}

function App() {
  // ...
}

const RootComponent = __DEV__
  ? App
  : (Sentry.wrap(App) as Parameters<typeof registerRootComponent>[0]);

registerRootComponent(RootComponent);

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions