@@ -30,7 +30,7 @@ Sentry.init({
3030 dsn: " ___PUBLIC_DSN___" ,
3131
3232 integrations: [
33- new Sentry.Tracing. ReactNativeTracing ({
33+ new Sentry.ReactNativeTracing ({
3434 tracingOrigins: [" localhost" , " my-site-url.com" , / ^ \/ / ],
3535 // ... other options
3636 }),
@@ -72,12 +72,12 @@ Note that this routing instrumentation will create a transaction on every route
7272import * as Sentry from " @sentry/react-native" ;
7373
7474// Construct a new instrumentation instance. This is needed to communicate between the integration and React
75- const reactNavigationV5Instrumentation = new Sentry.Tracing. ReactNavigationV5Instrumentation ();
75+ const reactNavigationV5Instrumentation = new Sentry.ReactNavigationV5Instrumentation ();
7676
7777Sentry .init ({
7878 ...
7979 integrations: [
80- new Sentry.Tracing. ReactNativeTracing ({
80+ new Sentry.ReactNativeTracing ({
8181 // Pass instrumentation to be used as `routingInstrumentation`
8282 routingInstrumentation: reactNavigationV5Instrumentation,
8383 // ...
@@ -110,24 +110,25 @@ You can configure this instrumentation by passing an object as the first argumen
110110` shouldSendTransaction ` (route, previousRoute) => boolean
111111
112112``` js
113-
114- const reactNavigationV5Instrumentation = new Sentry.Tracing.ReactNavigationV5Instrumentation ({
115- shouldSendTransaction : (route , previousRoute ) => {
116- if (route .name === ' Ignore-Route' ) {
117- return false ;
118- }
119-
120- if (route .params .containsSensitiveInfo ) {
121- return false ;
122- }
123-
124- if (previousRoute .name === ' ShouldIgnoreAfter' ) {
125- return false ;
126- }
127-
128- return true ;
113+ const reactNavigationV5Instrumentation = new Sentry.ReactNavigationV5Instrumentation (
114+ {
115+ shouldSendTransaction : (route , previousRoute ) => {
116+ if (route .name === " Ignore-Route" ) {
117+ return false ;
118+ }
119+
120+ if (route .params .containsSensitiveInfo ) {
121+ return false ;
122+ }
123+
124+ if (previousRoute .name === " ShouldIgnoreAfter" ) {
125+ return false ;
126+ }
127+
128+ return true ;
129+ },
129130 }
130- } );
131+ );
131132
132133// ...
133134```
@@ -138,12 +139,12 @@ Note that this routing instrumentation will create a transaction on every route
138139
139140``` js
140141// Construct a new instrumentation instance. This is needed to communicate between the integration and React
141- const reactNavigationV4Instrumentation = new Sentry.Tracing. ReactNavigationV4Instrumentation ();
142+ const reactNavigationV4Instrumentation = new Sentry.ReactNavigationV4Instrumentation ();
142143
143144Sentry .init ({
144145 ...
145146 integrations: [
146- new Sentry.Tracing. ReactNativeTracing ({
147+ new Sentry.ReactNativeTracing ({
147148 // Pass instrumentation to be used as `routingInstrumentation`
148149 routingInstrumentation: reactNavigationV4Instrumentation,
149150 ...
@@ -174,25 +175,26 @@ You can configure this instrumentation by passing an object as the first argumen
174175` shouldSendTransaction ` (route, previousRoute) => boolean
175176
176177``` js
177-
178- const reactNavigationV4Instrumentation = new Sentry.Tracing.ReactNavigationV4Instrumentation ({
179- shouldSendTransaction : (route , previousRoute ) => {
180- // Note that it is route.routeName here and NOT route.name like in V5, this is directly from React-Navigation
181- if (route .routeName === ' Ignore-Route' ) {
182- return false ;
183- }
184-
185- if (route .params .containsSensitiveInfo ) {
186- return false ;
187- }
188-
189- if (previousRoute .name === ' ShouldIgnoreAfter' ) {
190- return false ;
191- }
192-
193- return true ;
178+ const reactNavigationV4Instrumentation = new Sentry.ReactNavigationV4Instrumentation (
179+ {
180+ shouldSendTransaction : (route , previousRoute ) => {
181+ // Note that it is route.routeName here and NOT route.name like in V5, this is directly from React-Navigation
182+ if (route .routeName === " Ignore-Route" ) {
183+ return false ;
184+ }
185+
186+ if (route .params .containsSensitiveInfo ) {
187+ return false ;
188+ }
189+
190+ if (previousRoute .name === " ShouldIgnoreAfter" ) {
191+ return false ;
192+ }
193+
194+ return true ;
195+ },
194196 }
195- } );
197+ );
196198
197199// ...
198200```
@@ -211,12 +213,12 @@ You need to ensure that this method is called **before** the route change occurs
211213
212214``` js
213215// Construct a new instrumentation instance. This is needed to communicate between the integration and React
214- const routingInstrumentation = new Sentry.Tracing. RoutingInstrumentation ();
216+ const routingInstrumentation = new Sentry.RoutingInstrumentation ();
215217
216218Sentry .init ({
217219 ...
218220 integrations: [
219- new Sentry.Tracing. ReactNativeTracing ({
221+ new Sentry.ReactNativeTracing ({
220222 // Pass instrumentation to be used as `routingInstrumentation`
221223 routingInstrumentation,
222224 ...
@@ -237,27 +239,24 @@ const App = () => {
237239};
238240```
239241
240-
241242#### Extending
242243
243-
244244``` js
245245class CustomInstrumentation extends RoutingInstrumentation {
246-
247246 constructor (navigator ) {
248247 super ();
249-
248+
250249 this .navigator .registerRouteChangeListener (this .routeListener .bind (this ));
251250 }
252-
251+
253252 routeListener (newRoute ) {
254253 // Again, ensure this is called BEFORE the route changes and BEFORE the route is mounted.
255254 this .onRouteWillChange ({
256255 name: newRoute .name ,
257- op: ' navigation'
256+ op: " navigation" ,
258257 });
259258 }
260259}
261260```
262261
263- More extensive extension examples is by looking at our code for the React Navigation instrumentations.
262+ More extensive extension examples is by looking at our code for the React Navigation instrumentations.
0 commit comments