11import type { Scope } from '@sentry/core' ;
22import { getIntegrationsToSetup , Hub , initAndBind , makeMain , setExtra } from '@sentry/core' ;
3- import { RewriteFrames } from '@sentry/integrations' ;
43import {
54 defaultIntegrations as reactDefaultIntegrations ,
65 defaultStackParser ,
76 getCurrentHub ,
87 makeFetchTransport ,
98} from '@sentry/react' ;
10- import type { Integration , StackFrame , UserFeedback } from '@sentry/types' ;
9+ import type { Integration , UserFeedback } from '@sentry/types' ;
1110import { logger , stackParserFromStackParserOptions } from '@sentry/utils' ;
1211import * as React from 'react' ;
1312
@@ -22,6 +21,7 @@ import {
2221 Release ,
2322 SdkInfo ,
2423} from './integrations' ;
24+ import { createReactNativeRewriteFrames } from './integrations/rewriteframes' ;
2525import { Screenshot } from './integrations/screenshot' ;
2626import { ViewHierarchy } from './integrations/viewhierarchy' ;
2727import type { ReactNativeClientOptions , ReactNativeOptions , ReactNativeWrapperOptions } from './options' ;
@@ -107,29 +107,7 @@ export function init(passedOptions: ReactNativeOptions): void {
107107 defaultIntegrations . push ( new DebugSymbolicator ( ) ) ;
108108 }
109109
110- defaultIntegrations . push ( new RewriteFrames ( {
111- iteratee : ( frame : StackFrame ) => {
112- if ( frame . filename ) {
113- frame . filename = frame . filename
114- . replace ( / ^ f i l e : \/ \/ / , '' )
115- . replace ( / ^ a d d r e s s a t / , '' )
116- . replace ( / ^ .* \/ [ ^ . ] + ( \. a p p | C o d e P u s h | .* (? = \/ ) ) / , '' ) ;
117-
118- if (
119- frame . filename !== '[native code]' &&
120- frame . filename !== 'native'
121- ) {
122- const appPrefix = 'app://' ;
123- // We always want to have a triple slash
124- frame . filename =
125- frame . filename . indexOf ( '/' ) === 0
126- ? `${ appPrefix } ${ frame . filename } `
127- : `${ appPrefix } /${ frame . filename } ` ;
128- }
129- }
130- return frame ;
131- } ,
132- } ) ) ;
110+ defaultIntegrations . push ( createReactNativeRewriteFrames ( ) ) ;
133111 if ( options . enableNative ) {
134112 defaultIntegrations . push ( new DeviceContext ( ) ) ;
135113 }
0 commit comments