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
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@

## Unreleased

### Features

- Introducing `@sentry/react-native/playground` ([#4916](https://github.com/getsentry/sentry-react-native/pull/4916))

The new `withSentryPlayground` component allows developers to verify
that the SDK is properly configured and reports errors as expected.

```jsx
import * as Sentry from '@sentry/react-native';
import { withSentryPlayground } from '@sentry/react-native/playground';

function App() {
return <View>...</View>;
}

export default withSentryPlayground(
Sentry.wrap(App)
);
```

### Fixes

- User set by `Sentry.setUser` is prefilled in Feedback Widget ([#4901](https://github.com/getsentry/sentry-react-native/pull/4901))
Expand Down
2 changes: 2 additions & 0 deletions packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = {
'metro.d.ts',
'plugin/build/**/*',
'expo.d.ts',
'playground.js',
'playground.d.ts',
],
overrides: [
{
Expand Down
1 change: 1 addition & 0 deletions packages/core/playground.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './dist/js/playground';
1 change: 1 addition & 0 deletions packages/core/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './dist/js/playground';
Binary file added packages/core/playground_animations/bug.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/core/playground_animations/hi.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions packages/core/react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = {
ios: {},
android: {
packageInstance: 'new RNSentryPackage()',
packageImportPath: 'import io.sentry.react.RNSentryPackage;'
}
}
}
packageImportPath: 'import io.sentry.react.RNSentryPackage;',
},
},
},
};
8 changes: 8 additions & 0 deletions packages/core/src/js/playground/animations.tsx

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions packages/core/src/js/playground/examples.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { captureException } from '@sentry/core';

import { NATIVE } from '../wrapper';

// This is a placeholder to match the example code with what Sentry SDK users would see.
const Sentry = {
captureException,
nativeCrash: (): void => {
NATIVE.nativeCrash();
},
};

/**
* Example of error handling with Sentry integration.
*/
export const tryCatchExample = (): void => {
try {
// If you see the line below highlighted the source maps are working correctly.
throw new Error('This is a test caught error.');
} catch (e) {
Sentry.captureException(e);
}
};

/**
* Example of an uncaught error causing a crash from JS.
*/
export const uncaughtErrorExample = (): void => {
// If you see the line below highlighted the source maps are working correctly.
throw new Error('This is a test uncaught error.');
};

/**
* Example of a native crash.
*/
export const nativeCrashExample = (): void => {
Sentry.nativeCrash();
};
8 changes: 8 additions & 0 deletions packages/core/src/js/playground/images.tsx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/core/src/js/playground/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { withSentryPlayground } from './modal';
Loading
Loading