Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
@sentry/react-native
Advanced tools
@sentry/react-native is a comprehensive error tracking and performance monitoring tool for React Native applications. It helps developers capture and report errors, monitor application performance, and gain insights into issues affecting their apps.
Error Tracking
This feature allows you to capture and report errors in your React Native application. The code sample initializes Sentry with a DSN and captures an exception.
import * as Sentry from '@sentry/react-native';
Sentry.init({
dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
});
try {
throw new Error('Test error');
} catch (error) {
Sentry.captureException(error);
}
Performance Monitoring
This feature allows you to monitor the performance of your application. The code sample initializes Sentry with a DSN and a traces sample rate, then starts and finishes a transaction.
import * as Sentry from '@sentry/react-native';
Sentry.init({
dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
tracesSampleRate: 1.0,
});
const transaction = Sentry.startTransaction({
name: 'test-transaction',
});
setTimeout(() => {
transaction.finish();
}, 2000);
Breadcrumbs
Breadcrumbs are used to record events that lead up to an error. The code sample initializes Sentry and adds a breadcrumb for a user login event.
import * as Sentry from '@sentry/react-native';
Sentry.init({
dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
});
Sentry.addBreadcrumb({
category: 'auth',
message: 'User logged in',
level: Sentry.Severity.Info,
});
User Feedback
This feature allows users to provide feedback when an error occurs. The code sample initializes Sentry and shows a report dialog for user feedback.
import * as Sentry from '@sentry/react-native';
Sentry.init({
dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
});
Sentry.showReportDialog({
title: 'Feedback',
subtitle: 'Please describe what you were doing when the error occurred.',
labelName: 'Name',
labelEmail: 'Email',
labelComments: 'Comments',
labelSubmit: 'Submit',
successMessage: 'Thank you for your feedback!',
});
Bugsnag provides error monitoring and crash reporting for React Native applications. It offers similar functionalities to Sentry, such as error tracking, performance monitoring, and user feedback. Bugsnag is known for its user-friendly interface and detailed error reports.
Instabug provides comprehensive bug and crash reporting for React Native applications. It offers similar functionalities to Sentry, including error tracking, performance monitoring, and user feedback. Instabug is known for its in-app feedback and bug reporting capabilities, which allow users to report issues directly from the app.
Requirements:
react-native >= 0.38
for iOSreact-native >= 0.41
for Androidreact-native-sentry >= 0.39.0
requires react-native >= 0.56.0
sentry-cli >= 1.9.0
(brew install getsentry/tools/sentry-cli
)With this SDK, Sentry is now able to provide mixed stacktraces. This means that if a JavaScript call causes a crash in native code, you will see the last call from JavaScript before the crash. This also means that with the new SDK, native crashes are properly handled on iOS.
When using this library you will get a lot more information about the device surrounding your crashes.
Without native integration
With native integration
Mixed Stacktraces(1)
https://docs.sentry.io/clients/react-native/
(1)only supported on iOS
FAQs
Official Sentry SDK for react-native
The npm package @sentry/react-native receives a total of 286,236 weekly downloads. As such, @sentry/react-native popularity was classified as popular.
We found that @sentry/react-native demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.