Skip to content

Commit

Permalink
feat(integrations): Migrate to functional interface and direct export (
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich authored May 13, 2024
1 parent 8e270b4 commit 9eddef8
Show file tree
Hide file tree
Showing 37 changed files with 1,505 additions and 1,586 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@

## Unreleased

### Features

- Functional integrations ([#3814](https://github.com/getsentry/sentry-react-native/pull/3814))

Instead of installing `@sentry/integrations` and creating integrations using the `new` keyword, you can use direct imports of the functional integrations.

```js
// Before
import * as Sentry from '@sentry/react-native';
import { HttpClient } from '@sentry/integrations';

Sentry.init({
integrations: [
new Sentry.BrowserIntegrations.Dedupe(),
new Sentry.Integration.Screenshot(),
new HttpClient(),
],
});

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

Sentry.init({
integrations: [
Sentry.dedupeIntegration(),
Sentry.screenshotIntegration(),
Sentry.httpClientIntegration(),
],
});
```

Note that the `Sentry.BrowserIntegrations`, `Sentry.Integration` and the Class style integrations will be removed in the next major version of the SDK.

### Fixes

- Remove unused `rnpm` config ([#3811](https://github.com/getsentry/sentry-react-native/pull/3811))
Expand Down
11 changes: 9 additions & 2 deletions src/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export {
export { lastEventId } from '@sentry/browser';

import * as Integrations from './integrations';
import { SDK_NAME, SDK_VERSION } from './version';

export * from './integrations/exports';

export { SDK_NAME, SDK_VERSION } from './version';
export type { ReactNativeOptions } from './options';
export { ReactNativeClient } from './client';

Expand Down Expand Up @@ -100,4 +103,8 @@ export {
} from './tracing';

export type { ReactNavigationTransactionContext, TimeToDisplayProps } from './tracing';
export { Integrations, SDK_NAME, SDK_VERSION };

export {
/** @deprecated Import the integration function directly, e.g. `screenshotIntegration()` instead of `new Integrations.Screenshot(). */
Integrations,
};
Loading

0 comments on commit 9eddef8

Please sign in to comment.