@@ -3,20 +3,25 @@ import type { ReactotronCore, Plugin } from "reactotron-core-client"
3
3
// Attempt to require XHRInterceptor using static paths
4
4
let XHRInterceptorModule
5
5
try {
6
- // Try the new path first (for RN >= 0.79)
7
- // Yay breaking changes :( https://github.com/facebook/react-native/releases/tag/v0.79.0#:~:text=APIs%3A%20Move-,XHRInterceptor,-API%20to%20src
8
- XHRInterceptorModule = require ( "react-native/src/private/inspector/XHRInterceptor" )
6
+ // Try path first (for RN >= 0.80)
7
+ XHRInterceptorModule = require ( "react-native/src/private/devsupport/devmenu/elementinspector/XHRInterceptor" )
9
8
} catch ( e ) {
10
9
try {
11
- // Fallback to the old path (for RN < 0.79)
12
- XHRInterceptorModule = require ( "react-native/Libraries/Network/XHRInterceptor" )
10
+ // Try path for RN 0.79
11
+ // Yay breaking changes :( https://github.com/facebook/react-native/releases/tag/v0.79.0#:~:text=APIs%3A%20Move-,XHRInterceptor,-API%20to%20src
12
+ XHRInterceptorModule = require ( "react-native/src/private/inspector/XHRInterceptor" )
13
13
} catch ( e2 ) {
14
- console . error ( "Reactotron: Failed to require XHRInterceptor from both known paths." , e , e2 )
15
- console . warn (
16
- "Reactotron: XHRInterceptor could not be loaded. Network monitoring will be disabled."
17
- )
18
- // Assign a dummy object later if checks fail
19
- XHRInterceptorModule = null // Indicate failure to require
14
+ try {
15
+ // Fallback to the old path (for RN < 0.79)
16
+ XHRInterceptorModule = require ( "react-native/Libraries/Network/XHRInterceptor" )
17
+ } catch ( e3 ) {
18
+ console . error ( "Reactotron: Failed to require XHRInterceptor from all known paths." , e , e2 , e3 )
19
+ console . warn (
20
+ "Reactotron: XHRInterceptor could not be loaded. Network monitoring will be disabled."
21
+ )
22
+ // Assign a dummy object later if checks fail
23
+ XHRInterceptorModule = null // Indicate failure to require
24
+ }
20
25
}
21
26
}
22
27
0 commit comments