react-native-debug-toolkit 0.6.3 → 2.0.0
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/LICENSE +21 -0
- package/README.md +150 -212
- package/lib/commonjs/components/ClipboardTab.js +92 -0
- package/lib/commonjs/components/ClipboardTab.js.map +1 -0
- package/lib/commonjs/components/ConsoleLogTab.js +295 -0
- package/lib/commonjs/components/ConsoleLogTab.js.map +1 -0
- package/lib/commonjs/components/EnvironmentTab.js +288 -0
- package/lib/commonjs/components/EnvironmentTab.js.map +1 -0
- package/lib/commonjs/components/FloatPanelView.js +797 -0
- package/lib/commonjs/components/FloatPanelView.js.map +1 -0
- package/lib/commonjs/components/NavigationLogTab.js +131 -0
- package/lib/commonjs/components/NavigationLogTab.js.map +1 -0
- package/lib/commonjs/components/NetworkLogTab.js +575 -0
- package/lib/commonjs/components/NetworkLogTab.js.map +1 -0
- package/lib/commonjs/components/ThirdPartyLibsTab.js +97 -0
- package/lib/commonjs/components/ThirdPartyLibsTab.js.map +1 -0
- package/lib/commonjs/components/TrackLogTab.js +372 -0
- package/lib/commonjs/components/TrackLogTab.js.map +1 -0
- package/lib/commonjs/components/ZustandLogTab.js +451 -0
- package/lib/commonjs/components/ZustandLogTab.js.map +1 -0
- package/lib/commonjs/components/shared/CollapsibleSection.js +84 -0
- package/lib/commonjs/components/shared/CollapsibleSection.js.map +1 -0
- package/lib/commonjs/components/shared/CopyButton.js +64 -0
- package/lib/commonjs/components/shared/CopyButton.js.map +1 -0
- package/lib/commonjs/components/shared/JsonView.js +157 -0
- package/lib/commonjs/components/shared/JsonView.js.map +1 -0
- package/lib/commonjs/core/DebugToolkit.js +142 -0
- package/lib/commonjs/core/DebugToolkit.js.map +1 -0
- package/lib/commonjs/core/DebugToolkitProvider.js +64 -0
- package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -0
- package/lib/commonjs/features/ClipboardFeature.js +17 -0
- package/lib/commonjs/features/ClipboardFeature.js.map +1 -0
- package/lib/commonjs/features/ConsoleLogFeature.js +98 -0
- package/lib/commonjs/features/ConsoleLogFeature.js.map +1 -0
- package/lib/commonjs/features/EnvironmentFeature.js +168 -0
- package/lib/commonjs/features/EnvironmentFeature.js.map +1 -0
- package/lib/commonjs/features/NavigationLogFeature.js +60 -0
- package/lib/commonjs/features/NavigationLogFeature.js.map +1 -0
- package/lib/commonjs/features/NetworkFeature.js +328 -0
- package/lib/commonjs/features/NetworkFeature.js.map +1 -0
- package/lib/commonjs/features/ThirdPartyLibsFeature.js +51 -0
- package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +1 -0
- package/lib/commonjs/features/TrackFeature.js +55 -0
- package/lib/commonjs/features/TrackFeature.js.map +1 -0
- package/lib/commonjs/features/ZustandLogFeature.js +76 -0
- package/lib/commonjs/features/ZustandLogFeature.js.map +1 -0
- package/lib/commonjs/hooks/useNavigationLogger.js +78 -0
- package/lib/commonjs/hooks/useNavigationLogger.js.map +1 -0
- package/lib/commonjs/hooks/useSlideDetailAnimation.js +53 -0
- package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +1 -0
- package/lib/commonjs/index.js +165 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/initialize.js +161 -0
- package/lib/commonjs/initialize.js.map +1 -0
- package/lib/commonjs/native/NativeDebugLibs.js +58 -0
- package/lib/commonjs/native/NativeDebugLibs.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types/index.js +6 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/utils/constants.js +135 -0
- package/lib/commonjs/utils/constants.js.map +1 -0
- package/lib/commonjs/utils/copyToComputer.js +97 -0
- package/lib/commonjs/utils/copyToComputer.js.map +1 -0
- package/lib/commonjs/utils/createEventChannel.js +21 -0
- package/lib/commonjs/utils/createEventChannel.js.map +1 -0
- package/lib/commonjs/utils/createObservableStore.js +38 -0
- package/lib/commonjs/utils/createObservableStore.js.map +1 -0
- package/lib/commonjs/utils/safeStringify.js +27 -0
- package/lib/commonjs/utils/safeStringify.js.map +1 -0
- package/lib/module/components/ClipboardTab.js +86 -0
- package/lib/module/components/ClipboardTab.js.map +1 -0
- package/lib/module/components/ConsoleLogTab.js +290 -0
- package/lib/module/components/ConsoleLogTab.js.map +1 -0
- package/lib/module/components/EnvironmentTab.js +282 -0
- package/lib/module/components/EnvironmentTab.js.map +1 -0
- package/lib/module/components/FloatPanelView.js +791 -0
- package/lib/module/components/FloatPanelView.js.map +1 -0
- package/lib/module/components/NavigationLogTab.js +126 -0
- package/lib/module/components/NavigationLogTab.js.map +1 -0
- package/lib/module/components/NetworkLogTab.js +570 -0
- package/lib/module/components/NetworkLogTab.js.map +1 -0
- package/lib/module/components/ThirdPartyLibsTab.js +91 -0
- package/lib/module/components/ThirdPartyLibsTab.js.map +1 -0
- package/lib/module/components/TrackLogTab.js +367 -0
- package/lib/module/components/TrackLogTab.js.map +1 -0
- package/lib/module/components/ZustandLogTab.js +446 -0
- package/lib/module/components/ZustandLogTab.js.map +1 -0
- package/lib/module/components/shared/CollapsibleSection.js +78 -0
- package/lib/module/components/shared/CollapsibleSection.js.map +1 -0
- package/lib/module/components/shared/CopyButton.js +58 -0
- package/lib/module/components/shared/CopyButton.js.map +1 -0
- package/lib/module/components/shared/JsonView.js +152 -0
- package/lib/module/components/shared/JsonView.js.map +1 -0
- package/lib/module/core/DebugToolkit.js +137 -0
- package/lib/module/core/DebugToolkit.js.map +1 -0
- package/lib/module/core/DebugToolkitProvider.js +58 -0
- package/lib/module/core/DebugToolkitProvider.js.map +1 -0
- package/lib/module/features/ClipboardFeature.js +12 -0
- package/lib/module/features/ClipboardFeature.js.map +1 -0
- package/lib/module/features/ConsoleLogFeature.js +93 -0
- package/lib/module/features/ConsoleLogFeature.js.map +1 -0
- package/lib/module/features/EnvironmentFeature.js +164 -0
- package/lib/module/features/EnvironmentFeature.js.map +1 -0
- package/lib/module/features/NavigationLogFeature.js +54 -0
- package/lib/module/features/NavigationLogFeature.js.map +1 -0
- package/lib/module/features/NetworkFeature.js +322 -0
- package/lib/module/features/NetworkFeature.js.map +1 -0
- package/lib/module/features/ThirdPartyLibsFeature.js +46 -0
- package/lib/module/features/ThirdPartyLibsFeature.js.map +1 -0
- package/lib/module/features/TrackFeature.js +49 -0
- package/lib/module/features/TrackFeature.js.map +1 -0
- package/lib/module/features/ZustandLogFeature.js +69 -0
- package/lib/module/features/ZustandLogFeature.js.map +1 -0
- package/lib/module/hooks/useNavigationLogger.js +74 -0
- package/lib/module/hooks/useNavigationLogger.js.map +1 -0
- package/lib/module/hooks/useSlideDetailAnimation.js +50 -0
- package/lib/module/hooks/useSlideDetailAnimation.js.map +1 -0
- package/lib/module/index.js +29 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initialize.js +156 -0
- package/lib/module/initialize.js.map +1 -0
- package/lib/module/native/NativeDebugLibs.js +54 -0
- package/lib/module/native/NativeDebugLibs.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/constants.js +130 -0
- package/lib/module/utils/constants.js.map +1 -0
- package/lib/module/utils/copyToComputer.js +91 -0
- package/lib/module/utils/copyToComputer.js.map +1 -0
- package/lib/module/utils/createEventChannel.js +17 -0
- package/lib/module/utils/createEventChannel.js.map +1 -0
- package/lib/module/utils/createObservableStore.js +34 -0
- package/lib/module/utils/createObservableStore.js.map +1 -0
- package/lib/module/utils/safeStringify.js +23 -0
- package/lib/module/utils/safeStringify.js.map +1 -0
- package/lib/typescript/src/components/ClipboardTab.d.ts +4 -0
- package/lib/typescript/src/components/ClipboardTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ConsoleLogTab.d.ts +4 -0
- package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/EnvironmentTab.d.ts +4 -0
- package/lib/typescript/src/components/EnvironmentTab.d.ts.map +1 -0
- package/lib/typescript/src/components/FloatPanelView.d.ts +64 -0
- package/lib/typescript/src/components/FloatPanelView.d.ts.map +1 -0
- package/lib/typescript/src/components/NavigationLogTab.d.ts +4 -0
- package/lib/typescript/src/components/NavigationLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/NetworkLogTab.d.ts +4 -0
- package/lib/typescript/src/components/NetworkLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts +4 -0
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +1 -0
- package/lib/typescript/src/components/TrackLogTab.d.ts +4 -0
- package/lib/typescript/src/components/TrackLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ZustandLogTab.d.ts +4 -0
- package/lib/typescript/src/components/ZustandLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts +9 -0
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/CopyButton.d.ts +12 -0
- package/lib/typescript/src/components/shared/CopyButton.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/JsonView.d.ts +6 -0
- package/lib/typescript/src/components/shared/JsonView.d.ts.map +1 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts +27 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -0
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts +18 -0
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -0
- package/lib/typescript/src/features/ClipboardFeature.d.ts +3 -0
- package/lib/typescript/src/features/ClipboardFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts +7 -0
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/EnvironmentFeature.d.ts +8 -0
- package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/NavigationLogFeature.d.ts +8 -0
- package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/NetworkFeature.d.ts +28 -0
- package/lib/typescript/src/features/NetworkFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +3 -0
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/TrackFeature.d.ts +12 -0
- package/lib/typescript/src/features/TrackFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ZustandLogFeature.d.ts +29 -0
- package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts +20 -0
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts +11 -0
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +26 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/initialize.d.ts +51 -0
- package/lib/typescript/src/initialize.d.ts.map +1 -0
- package/lib/typescript/src/native/NativeDebugLibs.d.ts +11 -0
- package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +112 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/constants.d.ts +96 -0
- package/lib/typescript/src/utils/constants.d.ts.map +1 -0
- package/lib/typescript/src/utils/copyToComputer.d.ts +30 -0
- package/lib/typescript/src/utils/copyToComputer.d.ts.map +1 -0
- package/lib/typescript/src/utils/createEventChannel.d.ts +7 -0
- package/lib/typescript/src/utils/createEventChannel.d.ts.map +1 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts +9 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -0
- package/lib/typescript/src/utils/safeStringify.d.ts +6 -0
- package/lib/typescript/src/utils/safeStringify.d.ts.map +1 -0
- package/package.json +63 -24
- package/src/components/ClipboardTab.tsx +81 -0
- package/src/components/ConsoleLogTab.tsx +209 -0
- package/src/components/EnvironmentTab.tsx +276 -0
- package/src/components/FloatPanelView.tsx +714 -0
- package/src/components/NavigationLogTab.tsx +66 -0
- package/src/components/NetworkLogTab.tsx +411 -0
- package/src/components/ThirdPartyLibsTab.tsx +63 -0
- package/src/components/TrackLogTab.tsx +245 -0
- package/src/components/ZustandLogTab.tsx +305 -0
- package/src/components/shared/CollapsibleSection.tsx +78 -0
- package/src/components/shared/CopyButton.tsx +68 -0
- package/src/components/shared/JsonView.tsx +125 -0
- package/src/core/DebugToolkit.tsx +174 -0
- package/src/core/DebugToolkitProvider.tsx +89 -0
- package/src/features/ClipboardFeature.ts +11 -0
- package/src/features/ConsoleLogFeature.ts +118 -0
- package/src/features/EnvironmentFeature.ts +194 -0
- package/src/features/NavigationLogFeature.ts +74 -0
- package/src/features/NetworkFeature.ts +488 -0
- package/src/features/ThirdPartyLibsFeature.ts +42 -0
- package/src/features/TrackFeature.ts +69 -0
- package/src/features/ZustandLogFeature.ts +127 -0
- package/src/hooks/useNavigationLogger.ts +107 -0
- package/src/hooks/useSlideDetailAnimation.ts +45 -0
- package/src/index.ts +52 -0
- package/src/initialize.ts +214 -0
- package/src/native/NativeDebugLibs.ts +74 -0
- package/src/types/index.ts +138 -0
- package/src/utils/constants.ts +91 -0
- package/src/utils/copyToComputer.ts +104 -0
- package/src/utils/createEventChannel.ts +22 -0
- package/src/utils/createObservableStore.ts +42 -0
- package/src/utils/safeStringify.ts +25 -0
- package/.cursor/rules/react-native.mdc +0 -41
- package/README.zh-CN.md +0 -230
- package/android/build.gradle +0 -34
- package/android/src/main/AndroidManifest.xml +0 -8
- package/android/src/main/java/com/reactnative/debuglibs/BuildTypeModule.java +0 -44
- package/android/src/main/java/com/reactnative/debuglibs/BuildTypePackage.java +0 -25
- package/android/src/main/java/com/reactnative/debuglibs/RNDebugLibsModule.java +0 -75
- package/android/src/main/java/com/reactnative/debuglibs/RNDebugLibsPackage.java +0 -28
- package/index.js +0 -41
- package/ios/BuildTypeModule.h +0 -9
- package/ios/BuildTypeModule.m +0 -42
- package/ios/RNDebugLibs.h +0 -10
- package/ios/RNDebugLibs.m +0 -79
- package/lib/DebugToolKit.js +0 -126
- package/lib/EnvironmentManager.ts +0 -80
- package/lib/NativeDebugLibs.js +0 -67
- package/lib/features/ConsoleLogFeature.js +0 -70
- package/lib/features/NavigationLogFeature.js +0 -45
- package/lib/features/NetworkFeature.js +0 -389
- package/lib/features/PerformanceFeature.js +0 -390
- package/lib/features/ThirdPartyLibsFeature.js +0 -63
- package/lib/features/TrackFeature.js +0 -94
- package/lib/features/ZustandLogFeature.js +0 -44
- package/lib/hooks/useNavigationLogger.js +0 -92
- package/lib/index.js +0 -114
- package/lib/navigation/NavigationLogger.js +0 -1
- package/lib/types/TrackTypes.ts +0 -92
- package/lib/utils/DebugConst.js +0 -67
- package/lib/utils/StorageUtils.js +0 -80
- package/lib/views/ConsoleLogDetails.js +0 -314
- package/lib/views/FloatPanelView.js +0 -697
- package/lib/views/HttpLogDetails.js +0 -648
- package/lib/views/NavigationLogDetails.js +0 -302
- package/lib/views/RestartModal.js +0 -75
- package/lib/views/SubViewConsoleLogs.js +0 -209
- package/lib/views/SubViewEnvironment.js +0 -73
- package/lib/views/SubViewHTTPLogs.js +0 -235
- package/lib/views/SubViewNavigationLogs.js +0 -199
- package/lib/views/SubViewPerformance.js +0 -515
- package/lib/views/SubViewThirdPartyLibs.js +0 -239
- package/lib/views/SubViewTrackLogs.js +0 -318
- package/lib/views/SubViewZustandLogs.js +0 -279
- package/lib/views/TabView.js +0 -66
- package/lib/views/TrackLogDetails.js +0 -481
- package/lib/views/ZustandLogDetails.js +0 -355
- package/react-native-debug-toolkit.podspec +0 -25
- package/react-native.config.js +0 -18
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
FlatList,
|
|
7
|
-
TouchableOpacity,
|
|
8
|
-
} from 'react-native'
|
|
9
|
-
import HttpLogDetails from './HttpLogDetails'
|
|
10
|
-
|
|
11
|
-
const SubViewHTTPLogs = ({ logs = [] }) => {
|
|
12
|
-
const [selectedLog, setSelectedLog] = useState(null)
|
|
13
|
-
|
|
14
|
-
const getMethodColor = (method) => {
|
|
15
|
-
switch (method?.toUpperCase()) {
|
|
16
|
-
case 'GET':
|
|
17
|
-
return '#0D96F2' // Standard API blue
|
|
18
|
-
case 'POST':
|
|
19
|
-
return '#49CC90' // Swagger green
|
|
20
|
-
case 'PUT':
|
|
21
|
-
return '#FCA130' // Standard PUT orange
|
|
22
|
-
case 'DELETE':
|
|
23
|
-
return '#F93E3E' // Standard DELETE red
|
|
24
|
-
default:
|
|
25
|
-
return '#666666'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const renderLogItem = ({ item }) => {
|
|
30
|
-
// Check both HTTP status and API success flag
|
|
31
|
-
const isSuccess = item.response?.success ?? item.response?.status < 400
|
|
32
|
-
const statusColor = !isSuccess ? '#ff4444' : '#00C851'
|
|
33
|
-
const methodColor = getMethodColor(item.request?.method)
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<TouchableOpacity
|
|
37
|
-
style={styles.logItem}
|
|
38
|
-
onPress={() => setSelectedLog(item)}>
|
|
39
|
-
<View style={styles.logItemContainer}>
|
|
40
|
-
<View
|
|
41
|
-
style={[styles.statusIndicator, { backgroundColor: statusColor }]}
|
|
42
|
-
/>
|
|
43
|
-
|
|
44
|
-
<View style={styles.logContent}>
|
|
45
|
-
<View style={styles.methodRow}>
|
|
46
|
-
<Text style={[styles.method, { color: methodColor }]}>
|
|
47
|
-
{(item.request?.method || 'GET').toUpperCase()}
|
|
48
|
-
</Text>
|
|
49
|
-
<Text style={[styles.status, { color: statusColor }]}>
|
|
50
|
-
{item.response?.status || 'Error'}
|
|
51
|
-
</Text>
|
|
52
|
-
</View>
|
|
53
|
-
|
|
54
|
-
<Text
|
|
55
|
-
style={[styles.url, !isSuccess && styles.failedUrl]}
|
|
56
|
-
numberOfLines={2}>
|
|
57
|
-
{item.request?.url}
|
|
58
|
-
</Text>
|
|
59
|
-
|
|
60
|
-
<View style={styles.logFooter}>
|
|
61
|
-
<Text style={styles.time}>
|
|
62
|
-
{item.timestamp
|
|
63
|
-
? new Date(item.timestamp).toLocaleTimeString()
|
|
64
|
-
: ''}
|
|
65
|
-
</Text>
|
|
66
|
-
{!isSuccess && item.response?.data && (
|
|
67
|
-
<Text style={styles.errorMessage} numberOfLines={1}>
|
|
68
|
-
{item.response.data.message || 'Request Failed'}
|
|
69
|
-
</Text>
|
|
70
|
-
)}
|
|
71
|
-
</View>
|
|
72
|
-
</View>
|
|
73
|
-
</View>
|
|
74
|
-
</TouchableOpacity>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// If a log is selected, show the details view with a back button
|
|
79
|
-
if (selectedLog) {
|
|
80
|
-
return (
|
|
81
|
-
<View style={styles.container}>
|
|
82
|
-
<View style={styles.detailsHeader}>
|
|
83
|
-
<TouchableOpacity
|
|
84
|
-
style={styles.backButton}
|
|
85
|
-
onPress={() => setSelectedLog(null)}>
|
|
86
|
-
<Text style={styles.backButtonText}>← Back</Text>
|
|
87
|
-
</TouchableOpacity>
|
|
88
|
-
<View style={styles.headerMethodStatus}>
|
|
89
|
-
<Text
|
|
90
|
-
style={[
|
|
91
|
-
styles.headerMethod,
|
|
92
|
-
{ color: getMethodColor(selectedLog.request?.method) },
|
|
93
|
-
]}>
|
|
94
|
-
{(selectedLog.request?.method || 'GET').toUpperCase()}
|
|
95
|
-
</Text>
|
|
96
|
-
<Text
|
|
97
|
-
style={[
|
|
98
|
-
styles.headerStatus,
|
|
99
|
-
{
|
|
100
|
-
color:
|
|
101
|
-
selectedLog.response?.status >= 400
|
|
102
|
-
? '#ff4444'
|
|
103
|
-
: '#00C851',
|
|
104
|
-
},
|
|
105
|
-
]}>
|
|
106
|
-
{selectedLog.response?.status || 'Error'}
|
|
107
|
-
</Text>
|
|
108
|
-
</View>
|
|
109
|
-
</View>
|
|
110
|
-
<HttpLogDetails log={selectedLog} />
|
|
111
|
-
</View>
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Otherwise show the list view
|
|
116
|
-
return (
|
|
117
|
-
<View style={styles.container}>
|
|
118
|
-
{logs.length === 0 ? (
|
|
119
|
-
<Text style={styles.emptyText}>No HTTP requests logged yet</Text>
|
|
120
|
-
) : (
|
|
121
|
-
<FlatList
|
|
122
|
-
data={[...logs].sort((a, b) => b.timestamp - a.timestamp)}
|
|
123
|
-
renderItem={renderLogItem}
|
|
124
|
-
keyExtractor={(item, index) => index.toString()}
|
|
125
|
-
style={styles.list}
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
</View>
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const styles = StyleSheet.create({
|
|
133
|
-
container: {
|
|
134
|
-
flex: 1,
|
|
135
|
-
backgroundColor: '#fff',
|
|
136
|
-
},
|
|
137
|
-
list: {
|
|
138
|
-
flex: 1,
|
|
139
|
-
},
|
|
140
|
-
emptyText: {
|
|
141
|
-
textAlign: 'center',
|
|
142
|
-
color: '#999',
|
|
143
|
-
marginTop: 20,
|
|
144
|
-
},
|
|
145
|
-
logItem: {
|
|
146
|
-
borderBottomWidth: 1,
|
|
147
|
-
borderBottomColor: '#eee',
|
|
148
|
-
},
|
|
149
|
-
logItemContainer: {
|
|
150
|
-
flexDirection: 'row',
|
|
151
|
-
padding: 12,
|
|
152
|
-
},
|
|
153
|
-
statusIndicator: {
|
|
154
|
-
width: 4,
|
|
155
|
-
borderRadius: 2,
|
|
156
|
-
marginRight: 12,
|
|
157
|
-
},
|
|
158
|
-
logContent: {
|
|
159
|
-
flex: 1,
|
|
160
|
-
},
|
|
161
|
-
methodRow: {
|
|
162
|
-
flexDirection: 'row',
|
|
163
|
-
alignItems: 'center',
|
|
164
|
-
marginBottom: 6,
|
|
165
|
-
},
|
|
166
|
-
method: {
|
|
167
|
-
fontSize: 15,
|
|
168
|
-
fontWeight: 'bold',
|
|
169
|
-
marginRight: 8,
|
|
170
|
-
},
|
|
171
|
-
status: {
|
|
172
|
-
fontSize: 13,
|
|
173
|
-
fontWeight: '600',
|
|
174
|
-
},
|
|
175
|
-
url: {
|
|
176
|
-
fontSize: 13,
|
|
177
|
-
color: '#333',
|
|
178
|
-
marginBottom: 6,
|
|
179
|
-
lineHeight: 18,
|
|
180
|
-
},
|
|
181
|
-
failedUrl: {
|
|
182
|
-
color: '#ff4444',
|
|
183
|
-
},
|
|
184
|
-
logFooter: {
|
|
185
|
-
flexDirection: 'row',
|
|
186
|
-
justifyContent: 'space-between',
|
|
187
|
-
},
|
|
188
|
-
time: {
|
|
189
|
-
fontSize: 12,
|
|
190
|
-
color: '#999',
|
|
191
|
-
},
|
|
192
|
-
duration: {
|
|
193
|
-
fontSize: 12,
|
|
194
|
-
color: '#999',
|
|
195
|
-
},
|
|
196
|
-
errorMessage: {
|
|
197
|
-
color: '#ff4444',
|
|
198
|
-
fontSize: 12,
|
|
199
|
-
marginLeft: 8,
|
|
200
|
-
},
|
|
201
|
-
detailsHeader: {
|
|
202
|
-
flexDirection: 'row',
|
|
203
|
-
alignItems: 'center',
|
|
204
|
-
padding: 15,
|
|
205
|
-
borderBottomWidth: 1,
|
|
206
|
-
borderBottomColor: '#eee',
|
|
207
|
-
backgroundColor: '#f8f9fa',
|
|
208
|
-
},
|
|
209
|
-
backButton: {
|
|
210
|
-
paddingHorizontal: 10,
|
|
211
|
-
paddingVertical: 5,
|
|
212
|
-
borderRadius: 4,
|
|
213
|
-
backgroundColor: '#eee',
|
|
214
|
-
marginRight: 10,
|
|
215
|
-
},
|
|
216
|
-
backButtonText: {
|
|
217
|
-
color: '#333',
|
|
218
|
-
fontWeight: '500',
|
|
219
|
-
},
|
|
220
|
-
headerMethodStatus: {
|
|
221
|
-
flexDirection: 'row',
|
|
222
|
-
alignItems: 'center',
|
|
223
|
-
},
|
|
224
|
-
headerMethod: {
|
|
225
|
-
fontSize: 16,
|
|
226
|
-
fontWeight: 'bold',
|
|
227
|
-
marginRight: 10,
|
|
228
|
-
},
|
|
229
|
-
headerStatus: {
|
|
230
|
-
fontSize: 14,
|
|
231
|
-
fontWeight: '600',
|
|
232
|
-
},
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
export default SubViewHTTPLogs
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import React, { useState, useMemo } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
FlatList,
|
|
7
|
-
TouchableOpacity,
|
|
8
|
-
} from 'react-native'
|
|
9
|
-
import NavigationLogDetails from './NavigationLogDetails'
|
|
10
|
-
import { getNavigationActionColor } from '../utils/DebugConst'
|
|
11
|
-
|
|
12
|
-
const SubViewNavigationLogs = ({ logs = [] }) => {
|
|
13
|
-
const [selectedLog, setSelectedLog] = useState(null)
|
|
14
|
-
|
|
15
|
-
// Memoize the sorted logs
|
|
16
|
-
const sortedLogs = useMemo(() => {
|
|
17
|
-
// Create a stable copy before sorting if FlatList relies on reference equality
|
|
18
|
-
return [...logs].sort((a, b) => (b.timestamp || 0) - (a.timestamp || 0));
|
|
19
|
-
}, [logs]);
|
|
20
|
-
|
|
21
|
-
// Helper to format navigation data for preview
|
|
22
|
-
const formatNavigationPreview = (action, from, to) => {
|
|
23
|
-
const fromName = from?.name || 'Unknown';
|
|
24
|
-
const toName = to?.name || 'Unknown';
|
|
25
|
-
|
|
26
|
-
let preview = `${action || 'Navigate'}: ${fromName} → ${toName}`;
|
|
27
|
-
|
|
28
|
-
// Add params summary if available
|
|
29
|
-
if (to?.params) {
|
|
30
|
-
try {
|
|
31
|
-
const paramsStr = JSON.stringify(to.params);
|
|
32
|
-
const shortParams = paramsStr.length > 30 ? paramsStr.substring(0, 27) + '...' : paramsStr;
|
|
33
|
-
preview += ` ${shortParams}`;
|
|
34
|
-
} catch (e) {
|
|
35
|
-
preview += ' [with params]';
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return preview;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const renderLogItem = ({ item }) => {
|
|
43
|
-
const action = item.action || 'navigate';
|
|
44
|
-
const actionColor = getNavigationActionColor(action);
|
|
45
|
-
const previewText = formatNavigationPreview(action, item.from, item.to);
|
|
46
|
-
const timestamp = item.timestamp
|
|
47
|
-
? new Date(item.timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false })
|
|
48
|
-
: '';
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<TouchableOpacity
|
|
52
|
-
style={styles.logItem}
|
|
53
|
-
onPress={() => setSelectedLog(item)}>
|
|
54
|
-
<View style={styles.logItemContainer}>
|
|
55
|
-
<View
|
|
56
|
-
style={[styles.actionIndicator, { backgroundColor: actionColor }]}
|
|
57
|
-
/>
|
|
58
|
-
|
|
59
|
-
<View style={styles.logContent}>
|
|
60
|
-
<View style={styles.logHeader}>
|
|
61
|
-
<Text style={[styles.actionText, { color: actionColor }]}>
|
|
62
|
-
{action.toUpperCase()}
|
|
63
|
-
</Text>
|
|
64
|
-
<Text style={styles.time}>{timestamp}</Text>
|
|
65
|
-
</View>
|
|
66
|
-
|
|
67
|
-
<Text style={styles.logMessage} numberOfLines={2}>
|
|
68
|
-
{previewText}
|
|
69
|
-
</Text>
|
|
70
|
-
|
|
71
|
-
{item.duration && (
|
|
72
|
-
<Text style={styles.duration}>{`${item.duration} ms`}</Text>
|
|
73
|
-
)}
|
|
74
|
-
</View>
|
|
75
|
-
</View>
|
|
76
|
-
</TouchableOpacity>
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// If a log is selected, show the details view
|
|
81
|
-
if (selectedLog) {
|
|
82
|
-
return (
|
|
83
|
-
<View style={styles.container}>
|
|
84
|
-
<View style={styles.detailsHeader}>
|
|
85
|
-
<TouchableOpacity
|
|
86
|
-
style={styles.backButton}
|
|
87
|
-
onPress={() => setSelectedLog(null)}>
|
|
88
|
-
<Text style={styles.backButtonText}>← Back</Text>
|
|
89
|
-
</TouchableOpacity>
|
|
90
|
-
<Text style={styles.headerTitle}>Navigation Details</Text>
|
|
91
|
-
</View>
|
|
92
|
-
<NavigationLogDetails log={selectedLog} />
|
|
93
|
-
</View>
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Otherwise show the list view
|
|
98
|
-
return (
|
|
99
|
-
<View style={styles.container}>
|
|
100
|
-
{sortedLogs.length === 0 ? (
|
|
101
|
-
<Text style={styles.emptyText}>No navigation events logged yet</Text>
|
|
102
|
-
) : (
|
|
103
|
-
<FlatList
|
|
104
|
-
data={sortedLogs}
|
|
105
|
-
renderItem={renderLogItem}
|
|
106
|
-
keyExtractor={(item, index) => `${item.timestamp}-${index}`}
|
|
107
|
-
style={styles.list}
|
|
108
|
-
/>
|
|
109
|
-
)}
|
|
110
|
-
</View>
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Adapted styles from SubViewConsoleLogs
|
|
115
|
-
const styles = StyleSheet.create({
|
|
116
|
-
container: {
|
|
117
|
-
flex: 1,
|
|
118
|
-
backgroundColor: '#fff',
|
|
119
|
-
},
|
|
120
|
-
list: {
|
|
121
|
-
flex: 1,
|
|
122
|
-
},
|
|
123
|
-
emptyText: {
|
|
124
|
-
textAlign: 'center',
|
|
125
|
-
color: '#999',
|
|
126
|
-
marginTop: 20,
|
|
127
|
-
},
|
|
128
|
-
logItem: {
|
|
129
|
-
borderBottomWidth: 1,
|
|
130
|
-
borderBottomColor: '#eee',
|
|
131
|
-
},
|
|
132
|
-
logItemContainer: {
|
|
133
|
-
flexDirection: 'row',
|
|
134
|
-
paddingVertical: 10,
|
|
135
|
-
paddingHorizontal: 12,
|
|
136
|
-
},
|
|
137
|
-
actionIndicator: {
|
|
138
|
-
width: 4,
|
|
139
|
-
borderRadius: 2,
|
|
140
|
-
marginRight: 10,
|
|
141
|
-
},
|
|
142
|
-
logContent: {
|
|
143
|
-
flex: 1,
|
|
144
|
-
},
|
|
145
|
-
logHeader: {
|
|
146
|
-
flexDirection: 'row',
|
|
147
|
-
justifyContent: 'space-between',
|
|
148
|
-
alignItems: 'center',
|
|
149
|
-
marginBottom: 5,
|
|
150
|
-
},
|
|
151
|
-
actionText: {
|
|
152
|
-
fontSize: 13,
|
|
153
|
-
fontWeight: 'bold',
|
|
154
|
-
},
|
|
155
|
-
time: {
|
|
156
|
-
fontSize: 12,
|
|
157
|
-
color: '#888',
|
|
158
|
-
},
|
|
159
|
-
logMessage: {
|
|
160
|
-
fontSize: 14,
|
|
161
|
-
color: '#333',
|
|
162
|
-
lineHeight: 18,
|
|
163
|
-
fontFamily: 'monospace',
|
|
164
|
-
},
|
|
165
|
-
duration: {
|
|
166
|
-
fontSize: 12,
|
|
167
|
-
color: '#888',
|
|
168
|
-
marginTop: 4,
|
|
169
|
-
},
|
|
170
|
-
// Details Header Styles
|
|
171
|
-
detailsHeader: {
|
|
172
|
-
flexDirection: 'row',
|
|
173
|
-
alignItems: 'center',
|
|
174
|
-
paddingVertical: 10,
|
|
175
|
-
paddingHorizontal: 15,
|
|
176
|
-
borderBottomWidth: 1,
|
|
177
|
-
borderBottomColor: '#eee',
|
|
178
|
-
backgroundColor: '#f8f9fa',
|
|
179
|
-
},
|
|
180
|
-
backButton: {
|
|
181
|
-
paddingHorizontal: 10,
|
|
182
|
-
paddingVertical: 5,
|
|
183
|
-
borderRadius: 4,
|
|
184
|
-
backgroundColor: '#eee',
|
|
185
|
-
marginRight: 15,
|
|
186
|
-
},
|
|
187
|
-
backButtonText: {
|
|
188
|
-
color: '#333',
|
|
189
|
-
fontWeight: '500',
|
|
190
|
-
fontSize: 14,
|
|
191
|
-
},
|
|
192
|
-
headerTitle: {
|
|
193
|
-
fontSize: 16,
|
|
194
|
-
fontWeight: 'bold',
|
|
195
|
-
color: '#333',
|
|
196
|
-
},
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
export default SubViewNavigationLogs
|