@sentry/react-native
Advanced tools
Changelog
6.4.0-beta.1
Add Replay Custom Masking for iOS, Android and Web (#4224, #4265, #4272, #4314)
import * as Sentry from '@sentry/react-native';
const Example = () => {
return (
<View>
<Sentry.Mask>
<Text>${"All children of Sentry.Mask will be masked."}</Text>
</Sentry.Mask>
<Sentry.Unmask>
<Text>${"Only direct children of Sentry.Unmask will be unmasked."}</Text>
</Sentry.Unmask>
</View>
);
};
Changelog
6.3.0
Add support for .env.sentry-build-plugin
(#4281)
Don't commit the file to your repository. Use it to set your Sentry Auth Token.
SENTRY_AUTH_TOKEN=your_token_here
Add Sentry Metro Server Source Context middleware (#4287)
This enables the SDK to add source context to locally symbolicated events using the Metro Development Server.
The middleware can be disabled in metro.config.js
using the enableSourceContextInDevelopment
option.
// Expo
const { getSentryExpoConfig } = require('@sentry/react-native/metro');
const config = getSentryExpoConfig(__dirname, {
enableSourceContextInDevelopment: false,
});
// React Native
const { withSentryConfig } = require('@sentry/react-native/metro');
module.exports = withSentryConfig(config, {
enableSourceContextInDevelopment: false,
});
DebugSymbolicator
after RewriteFrames
to avoid overwrites by default (#4285)
RewriteFrames
is provided the order changesbrowserReplayIntegration
is no longer included by default on React Native Web (#4270).sentry
tmp directory and use environmental variables instead to save default Babel transformer path (#4298)
Changelog
6.3.0-beta.1
Add support for .env.sentry-build-plugin
(#4281)
Don't commit the file to your repository. Use it to set your Sentry Auth Token.
SENTRY_AUTH_TOKEN=your_token_here
Add Sentry Metro Server Source Context middleware (#4287)
This enables the SDK to add source context to locally symbolicated events using the Metro Development Server.
The middleware can be disabled in metro.config.js
using the enableSourceContextInDevelopment
option.
// Expo
const { getSentryExpoConfig } = require('@sentry/react-native/metro');
const config = getSentryExpoConfig(__dirname, {
enableSourceContextInDevelopment: false,
});
// React Native
const { withSentryConfig } = require('@sentry/react-native/metro');
module.exports = withSentryConfig(config, {
enableSourceContextInDevelopment: false,
});
DebugSymbolicator
after RewriteFrames
to avoid overwrites by default (#4285)
RewriteFrames
is provided the order changesbrowserReplayIntegration
is no longer included by default on React Native Web (#4270)Changelog
6.2.0
Enables Spotlight in Android and iOS SDKs (#4211)
Add env flag SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD
to allow disabling the debug file upload (#4223)
How to use in Android project? It works by default, just set export SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD=true
in your build environment. For Sentry Android Gradle Plugin add the following to your android/app/build.gradle
.
apply from: "../../../sentry.gradle"
sentry {
autoUploadProguardMapping = shouldSentryAutoUpload()
uploadNativeSymbols = shouldSentryAutoUpload()
}
How to use in Xcode? Make sure you are using scripts/sentry-xcode.sh
and scripts/sentry-xcode-debug-files.sh
in your
build phases. And add the following to your ios/.xcode.env.local
file.
export SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD=true
maskAll*
set to false
on iOS kept all masked (#4257)getRootSpan
, withActiveSpan
and suppressTracing
exports from @sentry/core
, and SeverityLevel
export from @sentry/types
(#4254, #4260)Changelog
6.0.0
This is a new major version 6.0.0 of the Sentry React Native SDK. To upgrade from the SDK version 5, please follow our migration guide.
React Native Tracing options were moved to the root options
import * as Sentry from '@sentry/react-native';
Sentry.init({
tracesSampleRate: 1.0,
enableAppStartTracking: true, // default true
enableNativeFramesTracking: true, // default true
enableStallTracking: true, // default true
enableUserInteractionTracing: true, // default false
integrations: [
Sentry.reactNativeTracingIntegration({
beforeStartSpan: (startSpanOptions) => {
startSpanOptions.name = 'New Name';
return startSpanOptions;
},
}),
Sentry.appStartIntegration({
standalone: false, // default false
}),
],
});
New React Navigation Integration interface (#4003)
import * as Sentry from '@sentry/react-native';
import { NavigationContainer } from '@react-navigation/native';
const reactNavigationIntegration = Sentry.reactNavigationIntegration();
Sentry.init({
tracesSampleRate: 1.0,
integrations: [reactNavigationIntegration],
});
function RootComponent() {
const navigation = React.useRef(null);
return <NavigationContainer ref={navigation}
onReady={() => {
reactNavigationIntegration.registerNavigationContainer(navigation);
}}>
</NavigationContainer>;
}
Removed beforeNavigate
use beforeStartSpan
instead (#3998)
beforeStartSpan
is executed before the span start, compared to beforeNavigate
which was executed before the navigation ended (after the span was created)Add sentry.origin
to SDK spans to indicated if spans are created by a part of the SDK or manually (#4066)
Xcode Debug Files upload completes in foreground by default (#4090)
Set parentSpanIsAlwaysRootSpan
to true
to make parent of network requests predictable (#4084)
Remove deprecated enableSpotlight
and spotlightSidecarUrl
(#4086)
tracePropagationTargets
defaults to all targets on mobile and same origin on the web (#4083)
Move _experiments.profilesSampleRate
to profilesSampleRate
root options object #3851)
Native Frames uses spanId
to attach frames replacing traceId
(#4030)
Removed deprecated ReactNativeTracing option idleTimeout
use idleTimeoutMs
instead (#3998)
Removed deprecated ReactNativeTracing option maxTransactionDuration
use finalTimeoutMs
instead (#3998)
New Native Frames Integration (#3996)
New Stall Tracking Integration (#3997)
New User Interaction Tracing Integration (#3999)
New App Start Integration (#3852)
New React Native Navigation Integration interface (#4003)
import * as Sentry from '@sentry/react-native';
import { Navigation } from 'react-native-navigation';
Sentry.init({
tracesSampleRate: 1.0,
integrations: [
Sentry.reactNativeNavigationIntegration({ navigation: Navigation })
],
});
setContext
ensures only values convertible to NativeMap are passed (#4168)setExtra
ensures only stringified values are passed (#4168)setContext('key', null)
removes the key value also from platform context (#4168)