react-native-xenon 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/lib/commonjs/assets/icons/record.png +0 -0
- package/lib/commonjs/colors.js +14 -0
- package/lib/commonjs/colors.js.map +1 -0
- package/lib/commonjs/hooks/useConsoleInterceptor.js +6 -7
- package/lib/commonjs/hooks/useConsoleInterceptor.js.map +1 -1
- package/lib/commonjs/hooks/useNetworkInterceptor.js +28 -24
- package/lib/commonjs/hooks/useNetworkInterceptor.js.map +1 -1
- package/lib/commonjs/icons.js +15 -0
- package/lib/commonjs/icons.js.map +1 -0
- package/lib/commonjs/interceptors/ConsoleInterceptor.js.map +1 -1
- package/lib/commonjs/interceptors/FetchInterceptor.js +5 -2
- package/lib/commonjs/interceptors/FetchInterceptor.js.map +1 -1
- package/lib/commonjs/interceptors/Interceptor.js +7 -1
- package/lib/commonjs/interceptors/Interceptor.js.map +1 -1
- package/lib/commonjs/interceptors/WebSocketInterceptor.js +11 -4
- package/lib/commonjs/interceptors/WebSocketInterceptor.js.map +1 -1
- package/lib/commonjs/interceptors/XHRInterceptor.js +4 -1
- package/lib/commonjs/interceptors/XHRInterceptor.js.map +1 -1
- package/lib/commonjs/types/index.js +8 -8
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/ui/Xenon.js +12 -9
- package/lib/commonjs/ui/Xenon.js.map +1 -1
- package/lib/commonjs/ui/components/bubble/Bubble.js +5 -2
- package/lib/commonjs/ui/components/bubble/Bubble.js.map +1 -1
- package/lib/commonjs/ui/components/details/LogMessageDetails.js +3 -1
- package/lib/commonjs/ui/components/details/LogMessageDetails.js.map +1 -1
- package/lib/commonjs/ui/components/details/NetworkRequestDetails.js +17 -19
- package/lib/commonjs/ui/components/details/NetworkRequestDetails.js.map +1 -1
- package/lib/commonjs/ui/components/headers/DebuggerHeader.js +9 -7
- package/lib/commonjs/ui/components/headers/DebuggerHeader.js.map +1 -1
- package/lib/commonjs/ui/components/headers/NetworkPanelHeader.js +22 -9
- package/lib/commonjs/ui/components/headers/NetworkPanelHeader.js.map +1 -1
- package/lib/commonjs/ui/components/index.js +2 -2
- package/lib/commonjs/ui/components/index.js.map +1 -1
- package/lib/commonjs/ui/components/items/ConsolePanelItem.js +3 -1
- package/lib/commonjs/ui/components/items/ConsolePanelItem.js.map +1 -1
- package/lib/commonjs/ui/components/items/DebuggerHeaderItem.js +17 -10
- package/lib/commonjs/ui/components/items/DebuggerHeaderItem.js.map +1 -1
- package/lib/commonjs/ui/components/items/NetworkPanelItem.js +21 -9
- package/lib/commonjs/ui/components/items/NetworkPanelItem.js.map +1 -1
- package/lib/commonjs/ui/components/items/NetworkRequestDetailsHeaderItem.js +4 -2
- package/lib/commonjs/ui/components/items/NetworkRequestDetailsHeaderItem.js.map +1 -1
- package/lib/commonjs/ui/components/items/NetworkRequestDetailsItem.js +4 -2
- package/lib/commonjs/ui/components/items/NetworkRequestDetailsItem.js.map +1 -1
- package/lib/commonjs/ui/components/panels/ConsolePanel.js +2 -1
- package/lib/commonjs/ui/components/panels/ConsolePanel.js.map +1 -1
- package/lib/commonjs/ui/components/panels/NetworkPanel.js +4 -2
- package/lib/commonjs/ui/components/panels/NetworkPanel.js.map +1 -1
- package/lib/commonjs/utils.js +7 -5
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/assets/icons/record.png +0 -0
- package/lib/module/colors.js +10 -0
- package/lib/module/colors.js.map +1 -0
- package/lib/module/hooks/useConsoleInterceptor.js +6 -7
- package/lib/module/hooks/useConsoleInterceptor.js.map +1 -1
- package/lib/module/hooks/useNetworkInterceptor.js +18 -14
- package/lib/module/hooks/useNetworkInterceptor.js.map +1 -1
- package/lib/module/icons.js +11 -0
- package/lib/module/icons.js.map +1 -0
- package/lib/module/interceptors/ConsoleInterceptor.js.map +1 -1
- package/lib/module/interceptors/FetchInterceptor.js +6 -3
- package/lib/module/interceptors/FetchInterceptor.js.map +1 -1
- package/lib/module/interceptors/Interceptor.js +7 -1
- package/lib/module/interceptors/Interceptor.js.map +1 -1
- package/lib/module/interceptors/WebSocketInterceptor.js +11 -4
- package/lib/module/interceptors/WebSocketInterceptor.js.map +1 -1
- package/lib/module/interceptors/XHRInterceptor.js +4 -1
- package/lib/module/interceptors/XHRInterceptor.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/ui/Xenon.js +13 -10
- package/lib/module/ui/Xenon.js.map +1 -1
- package/lib/module/ui/components/bubble/Bubble.js +4 -2
- package/lib/module/ui/components/bubble/Bubble.js.map +1 -1
- package/lib/module/ui/components/details/LogMessageDetails.js +2 -1
- package/lib/module/ui/components/details/LogMessageDetails.js.map +1 -1
- package/lib/module/ui/components/details/NetworkRequestDetails.js +18 -20
- package/lib/module/ui/components/details/NetworkRequestDetails.js.map +1 -1
- package/lib/module/ui/components/headers/DebuggerHeader.js +9 -7
- package/lib/module/ui/components/headers/DebuggerHeader.js.map +1 -1
- package/lib/module/ui/components/headers/NetworkPanelHeader.js +21 -9
- package/lib/module/ui/components/headers/NetworkPanelHeader.js.map +1 -1
- package/lib/module/ui/components/index.js +2 -2
- package/lib/module/ui/components/index.js.map +1 -1
- package/lib/module/ui/components/items/ConsolePanelItem.js +2 -1
- package/lib/module/ui/components/items/ConsolePanelItem.js.map +1 -1
- package/lib/module/ui/components/items/DebuggerHeaderItem.js +16 -10
- package/lib/module/ui/components/items/DebuggerHeaderItem.js.map +1 -1
- package/lib/module/ui/components/items/NetworkPanelItem.js +21 -10
- package/lib/module/ui/components/items/NetworkPanelItem.js.map +1 -1
- package/lib/module/ui/components/items/NetworkRequestDetailsHeaderItem.js +3 -2
- package/lib/module/ui/components/items/NetworkRequestDetailsHeaderItem.js.map +1 -1
- package/lib/module/ui/components/items/NetworkRequestDetailsItem.js +3 -2
- package/lib/module/ui/components/items/NetworkRequestDetailsItem.js.map +1 -1
- package/lib/module/ui/components/panels/ConsolePanel.js +2 -1
- package/lib/module/ui/components/panels/ConsolePanel.js.map +1 -1
- package/lib/module/ui/components/panels/NetworkPanel.js +4 -2
- package/lib/module/ui/components/panels/NetworkPanel.js.map +1 -1
- package/lib/module/utils.js +3 -2
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/commonjs/src/colors.d.ts +8 -0
- package/lib/typescript/commonjs/src/colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/contexts/MainContext.d.ts +1 -1
- package/lib/typescript/commonjs/src/contexts/MainContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useConsoleInterceptor.d.ts +2 -2
- package/lib/typescript/commonjs/src/hooks/useConsoleInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useNetworkInterceptor.d.ts +2 -2
- package/lib/typescript/commonjs/src/hooks/useNetworkInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/icons.d.ts +9 -0
- package/lib/typescript/commonjs/src/icons.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/interceptors/ConsoleInterceptor.d.ts +1 -1
- package/lib/typescript/commonjs/src/interceptors/ConsoleInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/interceptors/FetchInterceptor.d.ts +1 -1
- package/lib/typescript/commonjs/src/interceptors/FetchInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/interceptors/HttpInterceptor.d.ts +1 -1
- package/lib/typescript/commonjs/src/interceptors/Interceptor.d.ts +3 -1
- package/lib/typescript/commonjs/src/interceptors/Interceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/interceptors/WebSocketInterceptor.d.ts +4 -3
- package/lib/typescript/commonjs/src/interceptors/WebSocketInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/interceptors/XHRInterceptor.d.ts +1 -1
- package/lib/typescript/commonjs/src/interceptors/XHRInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/common.d.ts +2 -0
- package/lib/typescript/commonjs/src/types/common.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/http.d.ts +1 -2
- package/lib/typescript/commonjs/src/types/http.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/websocket.d.ts +6 -7
- package/lib/typescript/commonjs/src/types/websocket.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/Xenon.d.ts +4 -4
- package/lib/typescript/commonjs/src/ui/Xenon.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/bubble/Bubble.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/details/LogMessageDetails.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/details/NetworkRequestDetails.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/headers/DebuggerHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/headers/NetworkPanelHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/items/ConsolePanelItem.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/items/DebuggerHeaderItem.d.ts +1 -1
- package/lib/typescript/commonjs/src/ui/components/items/DebuggerHeaderItem.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/items/NetworkPanelItem.d.ts +5 -4
- package/lib/typescript/commonjs/src/ui/components/items/NetworkPanelItem.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/items/NetworkRequestDetailsHeaderItem.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/items/NetworkRequestDetailsItem.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/panels/ConsolePanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/panels/NetworkPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils.d.ts +3 -2
- package/lib/typescript/commonjs/src/utils.d.ts.map +1 -1
- package/lib/typescript/module/src/colors.d.ts +8 -0
- package/lib/typescript/module/src/colors.d.ts.map +1 -0
- package/lib/typescript/module/src/contexts/MainContext.d.ts +1 -1
- package/lib/typescript/module/src/contexts/MainContext.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useConsoleInterceptor.d.ts +2 -2
- package/lib/typescript/module/src/hooks/useConsoleInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useNetworkInterceptor.d.ts +2 -2
- package/lib/typescript/module/src/hooks/useNetworkInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/icons.d.ts +9 -0
- package/lib/typescript/module/src/icons.d.ts.map +1 -0
- package/lib/typescript/module/src/interceptors/ConsoleInterceptor.d.ts +1 -1
- package/lib/typescript/module/src/interceptors/ConsoleInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/interceptors/FetchInterceptor.d.ts +1 -1
- package/lib/typescript/module/src/interceptors/FetchInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/interceptors/HttpInterceptor.d.ts +1 -1
- package/lib/typescript/module/src/interceptors/Interceptor.d.ts +3 -1
- package/lib/typescript/module/src/interceptors/Interceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/interceptors/WebSocketInterceptor.d.ts +4 -3
- package/lib/typescript/module/src/interceptors/WebSocketInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/interceptors/XHRInterceptor.d.ts +1 -1
- package/lib/typescript/module/src/interceptors/XHRInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/types/common.d.ts +2 -0
- package/lib/typescript/module/src/types/common.d.ts.map +1 -1
- package/lib/typescript/module/src/types/http.d.ts +1 -2
- package/lib/typescript/module/src/types/http.d.ts.map +1 -1
- package/lib/typescript/module/src/types/index.d.ts +1 -1
- package/lib/typescript/module/src/types/index.d.ts.map +1 -1
- package/lib/typescript/module/src/types/websocket.d.ts +6 -7
- package/lib/typescript/module/src/types/websocket.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/Xenon.d.ts +4 -4
- package/lib/typescript/module/src/ui/Xenon.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/bubble/Bubble.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/details/LogMessageDetails.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/details/NetworkRequestDetails.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/headers/DebuggerHeader.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/headers/NetworkPanelHeader.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/index.d.ts +2 -2
- package/lib/typescript/module/src/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/items/ConsolePanelItem.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/items/DebuggerHeaderItem.d.ts +1 -1
- package/lib/typescript/module/src/ui/components/items/DebuggerHeaderItem.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/items/NetworkPanelItem.d.ts +5 -4
- package/lib/typescript/module/src/ui/components/items/NetworkPanelItem.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/items/NetworkRequestDetailsHeaderItem.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/items/NetworkRequestDetailsItem.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/panels/ConsolePanel.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/panels/NetworkPanel.d.ts.map +1 -1
- package/lib/typescript/module/src/utils.d.ts +3 -2
- package/lib/typescript/module/src/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/assets/icons/record.png +0 -0
- package/src/colors.ts +8 -0
- package/src/contexts/MainContext.ts +1 -1
- package/src/global.d.ts +4 -4
- package/src/hooks/useConsoleInterceptor.ts +5 -7
- package/src/hooks/useNetworkInterceptor.ts +19 -13
- package/src/icons.ts +9 -0
- package/src/interceptors/ConsoleInterceptor.ts +3 -3
- package/src/interceptors/FetchInterceptor.ts +7 -3
- package/src/interceptors/Interceptor.ts +9 -1
- package/src/interceptors/WebSocketInterceptor.ts +14 -5
- package/src/interceptors/XHRInterceptor.ts +7 -1
- package/src/types/common.ts +2 -0
- package/src/types/http.ts +1 -1
- package/src/types/index.ts +1 -1
- package/src/types/websocket.ts +6 -11
- package/src/ui/Xenon.tsx +110 -101
- package/src/ui/components/bubble/Bubble.tsx +4 -2
- package/src/ui/components/details/LogMessageDetails.tsx +2 -1
- package/src/ui/components/details/NetworkRequestDetails.tsx +29 -21
- package/src/ui/components/headers/DebuggerHeader.tsx +9 -13
- package/src/ui/components/headers/NetworkPanelHeader.tsx +20 -9
- package/src/ui/components/index.ts +2 -2
- package/src/ui/components/items/ConsolePanelItem.tsx +2 -1
- package/src/ui/components/items/DebuggerHeaderItem.tsx +18 -12
- package/src/ui/components/items/NetworkPanelItem.tsx +33 -13
- package/src/ui/components/items/NetworkRequestDetailsHeaderItem.tsx +3 -2
- package/src/ui/components/items/NetworkRequestDetailsItem.tsx +3 -2
- package/src/ui/components/panels/ConsolePanel.tsx +2 -1
- package/src/ui/components/panels/NetworkPanel.tsx +4 -2
- package/src/utils.ts +5 -2
- package/lib/commonjs/assets/record.png +0 -0
- package/lib/module/assets/record.png +0 -0
- package/src/assets/record.png +0 -0
- /package/lib/commonjs/assets/{code.png → icons/code.png} +0 -0
- /package/lib/commonjs/assets/{delete.png → icons/delete.png} +0 -0
- /package/lib/commonjs/assets/{hide.png → icons/hide.png} +0 -0
- /package/lib/commonjs/assets/{move.png → icons/move.png} +0 -0
- /package/lib/module/assets/{code.png → icons/code.png} +0 -0
- /package/lib/module/assets/{delete.png → icons/delete.png} +0 -0
- /package/lib/module/assets/{hide.png → icons/hide.png} +0 -0
- /package/lib/module/assets/{move.png → icons/move.png} +0 -0
- /package/src/assets/{code.png → icons/code.png} +0 -0
- /package/src/assets/{delete.png → icons/delete.png} +0 -0
- /package/src/assets/{hide.png → icons/hide.png} +0 -0
- /package/src/assets/{move.png → icons/move.png} +0 -0
package/src/ui/Xenon.tsx
CHANGED
@@ -1,9 +1,18 @@
|
|
1
|
-
import {
|
1
|
+
import { enableMapSet } from 'immer';
|
2
|
+
import {
|
3
|
+
createRef,
|
4
|
+
memo,
|
5
|
+
useImperativeHandle,
|
6
|
+
useRef,
|
7
|
+
useState,
|
8
|
+
type NamedExoticComponent,
|
9
|
+
} from 'react';
|
2
10
|
import { Animated, SafeAreaView, StyleSheet, useWindowDimensions, View } from 'react-native';
|
11
|
+
import colors from '../colors';
|
12
|
+
import MainContext, { type MainContextValue } from '../contexts/MainContext';
|
3
13
|
import { useConsoleInterceptor, useNetworkInterceptor } from '../hooks';
|
4
14
|
import { DebuggerPanel, type DebuggerPosition, type DebuggerVisibility } from '../types';
|
5
15
|
import { Bubble, ConsolePanel, DebuggerHeader, DetailsViewer, NetworkPanel } from './components';
|
6
|
-
import MainContext, { type MainContextValue } from '../contexts/MainContext';
|
7
16
|
|
8
17
|
interface XenonComponentMethods {
|
9
18
|
show(): void;
|
@@ -11,112 +20,112 @@ interface XenonComponentMethods {
|
|
11
20
|
}
|
12
21
|
|
13
22
|
interface XenonComponentProps {
|
14
|
-
|
15
|
-
|
23
|
+
autoInspectNetworkEnabled?: boolean;
|
24
|
+
autoInspectConsoleEnabled?: boolean;
|
16
25
|
bubbleSize?: number;
|
17
26
|
}
|
18
27
|
|
19
28
|
interface ReactNativeXenon extends XenonComponentMethods {
|
20
|
-
Component
|
29
|
+
Component: NamedExoticComponent<XenonComponentProps>;
|
21
30
|
}
|
22
31
|
|
32
|
+
enableMapSet();
|
33
|
+
|
23
34
|
const rootRef = createRef<XenonComponentMethods>();
|
24
35
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
);
|
119
|
-
}
|
36
|
+
const XenonComponent = memo<XenonComponentProps>(
|
37
|
+
({ autoInspectNetworkEnabled = true, autoInspectConsoleEnabled = true, bubbleSize = 40 }) => {
|
38
|
+
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
39
|
+
const verticalSafeMargin = screenHeight / 8;
|
40
|
+
|
41
|
+
const pan = useRef(new Animated.ValueXY({ x: 0, y: verticalSafeMargin }));
|
42
|
+
|
43
|
+
const detailsData: MainContextValue['detailsData'] = useRef(null);
|
44
|
+
|
45
|
+
const [debuggerVisibility, setDebuggerVisibility] = useState<DebuggerVisibility>('hidden');
|
46
|
+
|
47
|
+
const [debuggerPosition, setDebuggerPosition] = useState<DebuggerPosition>('bottom');
|
48
|
+
|
49
|
+
const [panelSelected, setPanelSelected] = useState<DebuggerPanel | null>(DebuggerPanel.Network);
|
50
|
+
|
51
|
+
const networkInterceptor = useNetworkInterceptor({
|
52
|
+
autoEnabled: autoInspectNetworkEnabled,
|
53
|
+
});
|
54
|
+
|
55
|
+
const logInterceptor = useConsoleInterceptor({
|
56
|
+
autoEnabled: autoInspectConsoleEnabled,
|
57
|
+
});
|
58
|
+
|
59
|
+
useImperativeHandle(
|
60
|
+
rootRef,
|
61
|
+
() => ({
|
62
|
+
show() {
|
63
|
+
setDebuggerVisibility('bubble');
|
64
|
+
},
|
65
|
+
hide() {
|
66
|
+
setDebuggerVisibility('hidden');
|
67
|
+
},
|
68
|
+
}),
|
69
|
+
[],
|
70
|
+
);
|
71
|
+
|
72
|
+
let content;
|
73
|
+
|
74
|
+
switch (debuggerVisibility) {
|
75
|
+
case 'bubble':
|
76
|
+
content = (
|
77
|
+
<View style={styles.bubbleBackdrop}>
|
78
|
+
<Bubble bubbleSize={bubbleSize} pan={pan} />
|
79
|
+
</View>
|
80
|
+
);
|
81
|
+
break;
|
82
|
+
case 'panel':
|
83
|
+
content = (
|
84
|
+
<SafeAreaView
|
85
|
+
style={[
|
86
|
+
styles.container,
|
87
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
88
|
+
{
|
89
|
+
[debuggerPosition]: 0,
|
90
|
+
height: Math.min(screenWidth, screenHeight) * 0.75,
|
91
|
+
},
|
92
|
+
]}
|
93
|
+
>
|
94
|
+
<DebuggerHeader />
|
95
|
+
|
96
|
+
{panelSelected === DebuggerPanel.Network && <NetworkPanel />}
|
97
|
+
{panelSelected === DebuggerPanel.Console && <ConsolePanel />}
|
98
|
+
|
99
|
+
{!panelSelected && !!detailsData.current && <DetailsViewer />}
|
100
|
+
</SafeAreaView>
|
101
|
+
);
|
102
|
+
break;
|
103
|
+
default:
|
104
|
+
content = null;
|
105
|
+
}
|
106
|
+
|
107
|
+
return (
|
108
|
+
<MainContext.Provider
|
109
|
+
value={{
|
110
|
+
debuggerVisibility,
|
111
|
+
setDebuggerVisibility,
|
112
|
+
debuggerPosition,
|
113
|
+
setDebuggerPosition,
|
114
|
+
panelSelected,
|
115
|
+
setPanelSelected,
|
116
|
+
networkInterceptor,
|
117
|
+
logInterceptor,
|
118
|
+
detailsData,
|
119
|
+
screenWidth,
|
120
|
+
screenHeight,
|
121
|
+
verticalSafeMargin,
|
122
|
+
}}
|
123
|
+
>
|
124
|
+
{content}
|
125
|
+
</MainContext.Provider>
|
126
|
+
);
|
127
|
+
},
|
128
|
+
);
|
120
129
|
|
121
130
|
const styles = StyleSheet.create({
|
122
131
|
container: {
|
@@ -125,7 +134,7 @@ const styles = StyleSheet.create({
|
|
125
134
|
top: undefined,
|
126
135
|
bottom: undefined,
|
127
136
|
zIndex: 9999,
|
128
|
-
backgroundColor:
|
137
|
+
backgroundColor: colors.lightGray,
|
129
138
|
},
|
130
139
|
bubbleBackdrop: {
|
131
140
|
flex: 1,
|
@@ -7,6 +7,8 @@ import {
|
|
7
7
|
type PanResponderGestureState,
|
8
8
|
} from 'react-native';
|
9
9
|
import { MainContext } from '../../../contexts';
|
10
|
+
import icons from '../../../icons';
|
11
|
+
import colors from '../../../colors';
|
10
12
|
|
11
13
|
interface BubbleProps {
|
12
14
|
bubbleSize: number;
|
@@ -73,7 +75,7 @@ export default function Bubble({ bubbleSize, pan }: BubbleProps) {
|
|
73
75
|
]}
|
74
76
|
>
|
75
77
|
<Image
|
76
|
-
source={
|
78
|
+
source={icons.code}
|
77
79
|
style={{
|
78
80
|
width: bubbleSize * 0.75,
|
79
81
|
height: bubbleSize * 0.75,
|
@@ -85,7 +87,7 @@ export default function Bubble({ bubbleSize, pan }: BubbleProps) {
|
|
85
87
|
|
86
88
|
const styles = StyleSheet.create({
|
87
89
|
bubble: {
|
88
|
-
backgroundColor:
|
90
|
+
backgroundColor: colors.lightGray,
|
89
91
|
position: 'absolute',
|
90
92
|
justifyContent: 'center',
|
91
93
|
alignItems: 'center',
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { ScrollView, StyleSheet, Text } from 'react-native';
|
2
2
|
import type { LogMessage } from '../../../types';
|
3
3
|
import { formatLogMessage } from '../../../utils';
|
4
|
+
import colors from '../../../colors';
|
4
5
|
|
5
6
|
interface LogMessageDetailsProps {
|
6
7
|
item: LogMessage;
|
@@ -21,6 +22,6 @@ const styles = StyleSheet.create({
|
|
21
22
|
},
|
22
23
|
divider: {
|
23
24
|
height: 1,
|
24
|
-
backgroundColor:
|
25
|
+
backgroundColor: colors.gray,
|
25
26
|
},
|
26
27
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useRef, useState, type JSX } from 'react';
|
1
|
+
import { useRef, useState, type JSX, type ReactNode } from 'react';
|
2
2
|
import { ScrollView, StyleSheet } from 'react-native';
|
3
3
|
import { URL } from 'react-native-url-polyfill';
|
4
4
|
import {
|
@@ -7,9 +7,16 @@ import {
|
|
7
7
|
type NetworkTab,
|
8
8
|
type WebSocketRequest,
|
9
9
|
} from '../../../types';
|
10
|
-
import {
|
10
|
+
import {
|
11
|
+
convertToCurl,
|
12
|
+
formatRequestDuration,
|
13
|
+
formatRequestMethod,
|
14
|
+
formatRequestStatusCode,
|
15
|
+
limitChar,
|
16
|
+
} from '../../../utils';
|
11
17
|
import NetworkDetailsHeader from '../headers/NetworkRequestDetailsHeader';
|
12
18
|
import NetworkRequestDetailsItem from '../items/NetworkRequestDetailsItem';
|
19
|
+
import colors from '../../../colors';
|
13
20
|
|
14
21
|
interface NetworkRequestDetailsProps {
|
15
22
|
item: HttpRequest | WebSocketRequest;
|
@@ -20,9 +27,9 @@ export default function NetworkRequestDetails({ item }: NetworkRequestDetailsPro
|
|
20
27
|
|
21
28
|
const isWebSocket = item.type === NetworkType.WS;
|
22
29
|
|
23
|
-
const requestUrl = new URL(
|
30
|
+
const requestUrl = new URL(item.url);
|
24
31
|
|
25
|
-
const headerShown =
|
32
|
+
const headerShown = !!item.url;
|
26
33
|
const queryStringParametersShown = !!requestUrl.search;
|
27
34
|
const bodyShown = !isWebSocket && !!item.body;
|
28
35
|
const responseShown = !isWebSocket && !!item.response;
|
@@ -41,17 +48,22 @@ export default function NetworkRequestDetails({ item }: NetworkRequestDetailsPro
|
|
41
48
|
<>
|
42
49
|
<NetworkRequestDetailsItem label="Request Type" content={item.type} />
|
43
50
|
|
51
|
+
<NetworkRequestDetailsItem label="Request URL" content={item.url} />
|
52
|
+
|
44
53
|
<NetworkRequestDetailsItem
|
45
|
-
label="Request
|
46
|
-
content={isWebSocket ?
|
54
|
+
label="Request Method"
|
55
|
+
content={formatRequestMethod(isWebSocket ? undefined : item.method)}
|
47
56
|
/>
|
48
57
|
|
49
58
|
<NetworkRequestDetailsItem
|
50
|
-
label="
|
51
|
-
content={
|
59
|
+
label="Duration"
|
60
|
+
content={formatRequestDuration(item.duration)}
|
52
61
|
/>
|
53
62
|
|
54
|
-
<NetworkRequestDetailsItem
|
63
|
+
<NetworkRequestDetailsItem
|
64
|
+
label="Status Code"
|
65
|
+
content={formatRequestStatusCode(item.status)}
|
66
|
+
/>
|
55
67
|
|
56
68
|
{isWebSocket && (
|
57
69
|
<NetworkRequestDetailsItem label="Headers" content={limitChar(item.options?.headers)} />
|
@@ -76,19 +88,15 @@ export default function NetworkRequestDetails({ item }: NetworkRequestDetailsPro
|
|
76
88
|
}
|
77
89
|
|
78
90
|
if (queryStringParametersShown && !content.current.queryStringParameters) {
|
79
|
-
const queryStringParameters:
|
91
|
+
const queryStringParameters: ReactNode[] = [];
|
80
92
|
|
81
93
|
requestUrl.searchParams.forEach((value, name) => {
|
82
|
-
queryStringParameters.push(
|
94
|
+
queryStringParameters.push(
|
95
|
+
<NetworkRequestDetailsItem key={name} label={name} content={value} />,
|
96
|
+
);
|
83
97
|
});
|
84
98
|
|
85
|
-
content.current.queryStringParameters =
|
86
|
-
<>
|
87
|
-
{queryStringParameters.map(({ name, value }, index) => (
|
88
|
-
<NetworkRequestDetailsItem key={index} label={name} content={value} />
|
89
|
-
))}
|
90
|
-
</>
|
91
|
-
);
|
99
|
+
content.current.queryStringParameters = <>{queryStringParameters}</>;
|
92
100
|
}
|
93
101
|
|
94
102
|
if (bodyShown && !content.current.body) {
|
@@ -126,15 +134,15 @@ const styles = StyleSheet.create({
|
|
126
134
|
},
|
127
135
|
divider: {
|
128
136
|
height: 1,
|
129
|
-
backgroundColor:
|
137
|
+
backgroundColor: colors.gray,
|
130
138
|
},
|
131
139
|
text: {
|
132
140
|
fontSize: 14,
|
133
|
-
color:
|
141
|
+
color: colors.black,
|
134
142
|
},
|
135
143
|
label: {
|
136
144
|
fontSize: 14,
|
137
145
|
fontWeight: 'bold',
|
138
|
-
color:
|
146
|
+
color: colors.black,
|
139
147
|
},
|
140
148
|
});
|
@@ -3,6 +3,8 @@ import { ScrollView, StyleSheet, View } from 'react-native';
|
|
3
3
|
import { MainContext } from '../../../contexts';
|
4
4
|
import { DebuggerPanel } from '../../../types';
|
5
5
|
import DebuggerHeaderItem from '../items/DebuggerHeaderItem';
|
6
|
+
import icons from '../../../icons';
|
7
|
+
import colors from '../../../colors';
|
6
8
|
|
7
9
|
export default function DebuggerHeader() {
|
8
10
|
const {
|
@@ -49,12 +51,9 @@ export default function DebuggerHeader() {
|
|
49
51
|
contentContainerStyle={styles.contentContainer}
|
50
52
|
showsHorizontalScrollIndicator={false}
|
51
53
|
>
|
52
|
-
<DebuggerHeaderItem onPress={hideDebugger} content={
|
54
|
+
<DebuggerHeaderItem onPress={hideDebugger} content={icons.hide} />
|
53
55
|
|
54
|
-
<DebuggerHeaderItem
|
55
|
-
onPress={toggleDebuggerPosition}
|
56
|
-
content={require('../../../assets/move.png')}
|
57
|
-
/>
|
56
|
+
<DebuggerHeaderItem onPress={toggleDebuggerPosition} content={icons.move} />
|
58
57
|
|
59
58
|
<DebuggerHeaderItem
|
60
59
|
isLabel
|
@@ -66,12 +65,12 @@ export default function DebuggerHeader() {
|
|
66
65
|
<DebuggerHeaderItem
|
67
66
|
onPress={toggleNetworkInterception}
|
68
67
|
isActive={networkInterceptor.isInterceptorEnabled}
|
69
|
-
content={
|
68
|
+
content={icons.record}
|
70
69
|
/>
|
71
70
|
|
72
71
|
<DebuggerHeaderItem
|
73
72
|
onPress={networkInterceptor.clearAllNetworkRequests}
|
74
|
-
content={
|
73
|
+
content={icons.delete}
|
75
74
|
/>
|
76
75
|
|
77
76
|
<View style={styles.divider} />
|
@@ -86,13 +85,10 @@ export default function DebuggerHeader() {
|
|
86
85
|
<DebuggerHeaderItem
|
87
86
|
onPress={toggleLogInterception}
|
88
87
|
isActive={logInterceptor.isInterceptorEnabled}
|
89
|
-
content={
|
88
|
+
content={icons.record}
|
90
89
|
/>
|
91
90
|
|
92
|
-
<DebuggerHeaderItem
|
93
|
-
onPress={logInterceptor.clearAllLogMessages}
|
94
|
-
content={require('../../../assets/delete.png')}
|
95
|
-
/>
|
91
|
+
<DebuggerHeaderItem onPress={logInterceptor.clearAllLogMessages} content={icons.delete} />
|
96
92
|
</ScrollView>
|
97
93
|
);
|
98
94
|
}
|
@@ -107,6 +103,6 @@ const styles = StyleSheet.create({
|
|
107
103
|
},
|
108
104
|
divider: {
|
109
105
|
width: 1,
|
110
|
-
backgroundColor:
|
106
|
+
backgroundColor: colors.gray,
|
111
107
|
},
|
112
108
|
});
|
@@ -1,9 +1,18 @@
|
|
1
1
|
import { StyleSheet, Text, View } from 'react-native';
|
2
|
+
import colors from '../../../colors';
|
2
3
|
|
3
4
|
export default function NetworkPanelHeader() {
|
4
5
|
return (
|
5
6
|
<View style={styles.container}>
|
6
|
-
<View style={
|
7
|
+
<View style={styles.headerColumn}>
|
8
|
+
<Text numberOfLines={1} style={styles.itemText}>
|
9
|
+
Method
|
10
|
+
</Text>
|
11
|
+
</View>
|
12
|
+
|
13
|
+
<View style={styles.divider} />
|
14
|
+
|
15
|
+
<View style={[styles.headerColumn, styles.headerNameColumn]}>
|
7
16
|
<Text numberOfLines={1} style={styles.itemText}>
|
8
17
|
Name
|
9
18
|
</Text>
|
@@ -11,9 +20,9 @@ export default function NetworkPanelHeader() {
|
|
11
20
|
|
12
21
|
<View style={styles.divider} />
|
13
22
|
|
14
|
-
<View style={styles.headerColumn}>
|
23
|
+
<View style={[styles.headerColumn, styles.headerDurationColumn]}>
|
15
24
|
<Text numberOfLines={1} style={styles.itemText}>
|
16
|
-
|
25
|
+
Duration
|
17
26
|
</Text>
|
18
27
|
</View>
|
19
28
|
|
@@ -33,12 +42,14 @@ const styles = StyleSheet.create({
|
|
33
42
|
flex: 1,
|
34
43
|
flexDirection: 'row',
|
35
44
|
alignItems: 'center',
|
36
|
-
backgroundColor:
|
45
|
+
backgroundColor: colors.gray,
|
37
46
|
borderRadius: 4,
|
38
47
|
},
|
39
|
-
|
40
|
-
flex:
|
41
|
-
|
48
|
+
headerNameColumn: {
|
49
|
+
flex: 5,
|
50
|
+
},
|
51
|
+
headerDurationColumn: {
|
52
|
+
flex: 2,
|
42
53
|
},
|
43
54
|
headerColumn: {
|
44
55
|
flex: 1.5,
|
@@ -49,10 +60,10 @@ const styles = StyleSheet.create({
|
|
49
60
|
divider: {
|
50
61
|
height: 16,
|
51
62
|
width: 1,
|
52
|
-
backgroundColor:
|
63
|
+
backgroundColor: colors.gray,
|
53
64
|
},
|
54
65
|
itemText: {
|
55
66
|
fontSize: 14,
|
56
|
-
color:
|
67
|
+
color: colors.black,
|
57
68
|
},
|
58
69
|
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export { default as Bubble } from './bubble/Bubble';
|
2
|
+
export { default as DetailsViewer } from './details/DetailsViewer';
|
2
3
|
export { default as DebuggerHeader } from './headers/DebuggerHeader';
|
3
|
-
export { default as NetworkPanel } from './panels/NetworkPanel';
|
4
4
|
export { default as ConsolePanel } from './panels/ConsolePanel';
|
5
|
-
export { default as
|
5
|
+
export { default as NetworkPanel } from './panels/NetworkPanel';
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { StyleSheet, Text, TouchableOpacity } from 'react-native';
|
2
2
|
import type { LogMessage } from '../../../types';
|
3
3
|
import { formatLogMessage } from '../../../utils';
|
4
|
+
import colors from '../../../colors';
|
4
5
|
|
5
6
|
interface ConsolePanelItemProps extends LogMessage {
|
6
7
|
onPress: () => void;
|
@@ -22,7 +23,7 @@ const styles = StyleSheet.create({
|
|
22
23
|
padding: 8,
|
23
24
|
},
|
24
25
|
text: {
|
25
|
-
color:
|
26
|
+
color: colors.black,
|
26
27
|
fontSize: 14,
|
27
28
|
},
|
28
29
|
});
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Image, StyleSheet, Text, TouchableOpacity, type ImageRequireSource } from 'react-native';
|
2
|
+
import colors from '../../../colors';
|
2
3
|
|
3
4
|
interface DebuggerHeaderItemProps {
|
4
5
|
content?: ImageRequireSource | string;
|
@@ -7,26 +8,31 @@ interface DebuggerHeaderItemProps {
|
|
7
8
|
onPress: () => void;
|
8
9
|
}
|
9
10
|
|
10
|
-
export default function DebuggerHeaderItem(
|
11
|
+
export default function DebuggerHeaderItem({
|
12
|
+
content,
|
13
|
+
isLabel,
|
14
|
+
isActive,
|
15
|
+
onPress,
|
16
|
+
}: DebuggerHeaderItemProps) {
|
11
17
|
return (
|
12
18
|
<TouchableOpacity
|
13
|
-
onPress={
|
19
|
+
onPress={onPress}
|
14
20
|
activeOpacity={0.8}
|
15
21
|
style={[
|
16
22
|
styles.container,
|
17
|
-
|
18
|
-
?
|
23
|
+
isLabel
|
24
|
+
? isActive
|
19
25
|
? styles.activeLabelContainer
|
20
26
|
: styles.labelContainer
|
21
|
-
:
|
27
|
+
: isActive
|
22
28
|
? styles.activeContainer
|
23
29
|
: undefined,
|
24
30
|
]}
|
25
31
|
>
|
26
|
-
{typeof
|
27
|
-
<Text style={styles.title}>{
|
32
|
+
{typeof content === 'string' ? (
|
33
|
+
<Text style={styles.title}>{content}</Text>
|
28
34
|
) : (
|
29
|
-
<Image source={
|
35
|
+
<Image source={content} style={styles.icon} />
|
30
36
|
)}
|
31
37
|
</TouchableOpacity>
|
32
38
|
);
|
@@ -37,7 +43,7 @@ const styles = StyleSheet.create({
|
|
37
43
|
paddingVertical: 4,
|
38
44
|
paddingHorizontal: 8,
|
39
45
|
borderRadius: 4,
|
40
|
-
backgroundColor:
|
46
|
+
backgroundColor: colors.gray,
|
41
47
|
borderWidth: 1,
|
42
48
|
borderColor: 'transparent',
|
43
49
|
},
|
@@ -47,16 +53,16 @@ const styles = StyleSheet.create({
|
|
47
53
|
activeLabelContainer: {
|
48
54
|
backgroundColor: 'transparent',
|
49
55
|
borderWidth: 1,
|
50
|
-
borderColor:
|
56
|
+
borderColor: colors.black,
|
51
57
|
},
|
52
58
|
activeContainer: {
|
53
|
-
backgroundColor:
|
59
|
+
backgroundColor: colors.red,
|
54
60
|
},
|
55
61
|
title: {
|
56
62
|
fontSize: 14,
|
57
63
|
lineHeight: 17,
|
58
64
|
fontWeight: '500',
|
59
|
-
color:
|
65
|
+
color: colors.black,
|
60
66
|
},
|
61
67
|
icon: {
|
62
68
|
width: 17,
|