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,279 +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 ZustandLogDetails from './ZustandLogDetails'
|
|
10
|
-
import { getZustandActionColor } from '../utils/DebugConst'
|
|
11
|
-
|
|
12
|
-
const SubViewZustandLogs = ({ logs = [] }) => {
|
|
13
|
-
const [selectedLog, setSelectedLog] = useState(null)
|
|
14
|
-
|
|
15
|
-
// Memoize the sorted logs
|
|
16
|
-
const sortedLogs = useMemo(() => {
|
|
17
|
-
// Create a stable copy before sorting
|
|
18
|
-
return [...logs].sort((a, b) => (b.timestamp || 0) - (a.timestamp || 0));
|
|
19
|
-
}, [logs]);
|
|
20
|
-
|
|
21
|
-
// Helper to format preview of state changes
|
|
22
|
-
const formatActionPreview = (log) => {
|
|
23
|
-
if (!log) return '';
|
|
24
|
-
|
|
25
|
-
const { action = 'unknown', storeName } = log;
|
|
26
|
-
return `Action: ${action}${storeName ? ` (${storeName})` : ''}`;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// Safely stringify value for display
|
|
30
|
-
const safeStringify = (value) => {
|
|
31
|
-
if (value === undefined) return 'undefined';
|
|
32
|
-
if (value === null) return 'null';
|
|
33
|
-
|
|
34
|
-
const type = typeof value;
|
|
35
|
-
if (type === 'string') return `"${value.length > 10 ? value.substring(0, 10) + '...' : value}"`;
|
|
36
|
-
if (type === 'number' || type === 'boolean') return String(value);
|
|
37
|
-
if (Array.isArray(value)) return '[...]';
|
|
38
|
-
if (type === 'object') return '{...}';
|
|
39
|
-
|
|
40
|
-
return String(value);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Helper to find key changes between states with more details
|
|
44
|
-
const findChangedKeys = (prevState, nextState) => {
|
|
45
|
-
if (!prevState || !nextState) return [];
|
|
46
|
-
|
|
47
|
-
const changes = [];
|
|
48
|
-
const allKeys = new Set([...Object.keys(prevState), ...Object.keys(nextState)]);
|
|
49
|
-
|
|
50
|
-
allKeys.forEach(key => {
|
|
51
|
-
const prevValue = prevState[key];
|
|
52
|
-
const nextValue = nextState[key];
|
|
53
|
-
|
|
54
|
-
// Check if key is added, removed, or value changed
|
|
55
|
-
if (!(key in prevState)) {
|
|
56
|
-
changes.push({
|
|
57
|
-
key,
|
|
58
|
-
type: 'added',
|
|
59
|
-
display: `+${key}: ${safeStringify(nextValue)}`
|
|
60
|
-
});
|
|
61
|
-
} else if (!(key in nextState)) {
|
|
62
|
-
changes.push({
|
|
63
|
-
key,
|
|
64
|
-
type: 'removed',
|
|
65
|
-
display: `-${key}: ${safeStringify(prevValue)}`
|
|
66
|
-
});
|
|
67
|
-
} else if (JSON.stringify(prevValue) !== JSON.stringify(nextValue)) {
|
|
68
|
-
// For primitive types, show the before and after values
|
|
69
|
-
const isPrimitive =
|
|
70
|
-
typeof prevValue !== 'object' ||
|
|
71
|
-
prevValue === null ||
|
|
72
|
-
typeof nextValue !== 'object' ||
|
|
73
|
-
nextValue === null;
|
|
74
|
-
|
|
75
|
-
if (isPrimitive) {
|
|
76
|
-
changes.push({
|
|
77
|
-
key,
|
|
78
|
-
type: 'changed',
|
|
79
|
-
display: `~${key}: ${safeStringify(prevValue)} → ${safeStringify(nextValue)}`
|
|
80
|
-
});
|
|
81
|
-
} else {
|
|
82
|
-
changes.push({
|
|
83
|
-
key,
|
|
84
|
-
type: 'changed',
|
|
85
|
-
display: `~${key}`
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
return changes;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const renderLogItem = ({ item }) => {
|
|
95
|
-
const actionPreview = formatActionPreview(item);
|
|
96
|
-
const actionColor = getZustandActionColor(item.action);
|
|
97
|
-
const timestamp = item.timestamp
|
|
98
|
-
? new Date(item.timestamp).toLocaleTimeString([], {
|
|
99
|
-
hour: '2-digit',
|
|
100
|
-
minute: '2-digit',
|
|
101
|
-
second: '2-digit',
|
|
102
|
-
hour12: false
|
|
103
|
-
})
|
|
104
|
-
: '';
|
|
105
|
-
|
|
106
|
-
// Get changed keys with details
|
|
107
|
-
const changes = findChangedKeys(item.prevState, item.nextState);
|
|
108
|
-
|
|
109
|
-
// Create a formatted display of changes
|
|
110
|
-
const changesText = changes.length
|
|
111
|
-
? changes.map(change => change.display).join(', ')
|
|
112
|
-
: 'No changes detected';
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<TouchableOpacity
|
|
116
|
-
style={styles.logItem}
|
|
117
|
-
onPress={() => setSelectedLog(item)}>
|
|
118
|
-
<View style={styles.logItemContainer}>
|
|
119
|
-
<View
|
|
120
|
-
style={[styles.actionIndicator, { backgroundColor: actionColor }]}
|
|
121
|
-
/>
|
|
122
|
-
|
|
123
|
-
<View style={styles.logContent}>
|
|
124
|
-
<View style={styles.logHeader}>
|
|
125
|
-
<Text style={[styles.actionText, { color: actionColor }]}>
|
|
126
|
-
{actionPreview}
|
|
127
|
-
</Text>
|
|
128
|
-
<Text style={styles.time}>{timestamp}</Text>
|
|
129
|
-
</View>
|
|
130
|
-
|
|
131
|
-
<Text style={styles.statePathsText} numberOfLines={2}>
|
|
132
|
-
{changesText}
|
|
133
|
-
</Text>
|
|
134
|
-
</View>
|
|
135
|
-
</View>
|
|
136
|
-
</TouchableOpacity>
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// If a log is selected, show the details view
|
|
141
|
-
if (selectedLog) {
|
|
142
|
-
const timestamp = selectedLog.timestamp
|
|
143
|
-
? new Date(selectedLog.timestamp).toLocaleTimeString([], {
|
|
144
|
-
hour: '2-digit',
|
|
145
|
-
minute: '2-digit',
|
|
146
|
-
second: '2-digit',
|
|
147
|
-
hour12: false
|
|
148
|
-
})
|
|
149
|
-
: '';
|
|
150
|
-
const actionColor = getZustandActionColor(selectedLog.action);
|
|
151
|
-
const actionDisplay = selectedLog.storeName
|
|
152
|
-
? `${selectedLog.action} (${selectedLog.storeName})`
|
|
153
|
-
: selectedLog.action || 'Unknown Action';
|
|
154
|
-
|
|
155
|
-
return (
|
|
156
|
-
<View style={styles.container}>
|
|
157
|
-
<View style={styles.detailsHeader}>
|
|
158
|
-
<TouchableOpacity
|
|
159
|
-
style={styles.backButton}
|
|
160
|
-
onPress={() => setSelectedLog(null)}>
|
|
161
|
-
<Text style={styles.backButtonText}>← Back</Text>
|
|
162
|
-
</TouchableOpacity>
|
|
163
|
-
<View style={styles.headerActionTime}>
|
|
164
|
-
<Text style={[styles.headerAction, { color: actionColor }]}>
|
|
165
|
-
{actionDisplay}
|
|
166
|
-
</Text>
|
|
167
|
-
<Text style={styles.headerTimestamp}>{timestamp}</Text>
|
|
168
|
-
</View>
|
|
169
|
-
</View>
|
|
170
|
-
<ZustandLogDetails log={selectedLog} />
|
|
171
|
-
</View>
|
|
172
|
-
)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Otherwise show the list view
|
|
176
|
-
return (
|
|
177
|
-
<View style={styles.container}>
|
|
178
|
-
{sortedLogs.length === 0 ? (
|
|
179
|
-
<Text style={styles.emptyText}>No Zustand state changes logged yet</Text>
|
|
180
|
-
) : (
|
|
181
|
-
<FlatList
|
|
182
|
-
data={sortedLogs}
|
|
183
|
-
renderItem={renderLogItem}
|
|
184
|
-
keyExtractor={(item, index) => `${item.timestamp}-${index}`}
|
|
185
|
-
style={styles.list}
|
|
186
|
-
/>
|
|
187
|
-
)}
|
|
188
|
-
</View>
|
|
189
|
-
)
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Adapted styles from SubViewConsoleLogs
|
|
193
|
-
const styles = StyleSheet.create({
|
|
194
|
-
container: {
|
|
195
|
-
flex: 1,
|
|
196
|
-
backgroundColor: '#fff',
|
|
197
|
-
},
|
|
198
|
-
list: {
|
|
199
|
-
flex: 1,
|
|
200
|
-
},
|
|
201
|
-
emptyText: {
|
|
202
|
-
textAlign: 'center',
|
|
203
|
-
color: '#999',
|
|
204
|
-
marginTop: 20,
|
|
205
|
-
},
|
|
206
|
-
logItem: {
|
|
207
|
-
borderBottomWidth: 1,
|
|
208
|
-
borderBottomColor: '#eee',
|
|
209
|
-
},
|
|
210
|
-
logItemContainer: {
|
|
211
|
-
flexDirection: 'row',
|
|
212
|
-
paddingVertical: 10,
|
|
213
|
-
paddingHorizontal: 12,
|
|
214
|
-
},
|
|
215
|
-
actionIndicator: {
|
|
216
|
-
width: 4,
|
|
217
|
-
borderRadius: 2,
|
|
218
|
-
marginRight: 10,
|
|
219
|
-
},
|
|
220
|
-
logContent: {
|
|
221
|
-
flex: 1,
|
|
222
|
-
},
|
|
223
|
-
logHeader: {
|
|
224
|
-
flexDirection: 'row',
|
|
225
|
-
justifyContent: 'space-between',
|
|
226
|
-
alignItems: 'center',
|
|
227
|
-
marginBottom: 5,
|
|
228
|
-
},
|
|
229
|
-
actionText: {
|
|
230
|
-
fontSize: 13,
|
|
231
|
-
fontWeight: 'bold',
|
|
232
|
-
},
|
|
233
|
-
time: {
|
|
234
|
-
fontSize: 12,
|
|
235
|
-
color: '#888',
|
|
236
|
-
},
|
|
237
|
-
statePathsText: {
|
|
238
|
-
fontSize: 14,
|
|
239
|
-
color: '#555',
|
|
240
|
-
fontFamily: 'monospace',
|
|
241
|
-
},
|
|
242
|
-
// Details Header Styles
|
|
243
|
-
detailsHeader: {
|
|
244
|
-
flexDirection: 'row',
|
|
245
|
-
alignItems: 'center',
|
|
246
|
-
paddingVertical: 10,
|
|
247
|
-
paddingHorizontal: 15,
|
|
248
|
-
borderBottomWidth: 1,
|
|
249
|
-
borderBottomColor: '#eee',
|
|
250
|
-
backgroundColor: '#f8f9fa',
|
|
251
|
-
},
|
|
252
|
-
backButton: {
|
|
253
|
-
paddingHorizontal: 10,
|
|
254
|
-
paddingVertical: 5,
|
|
255
|
-
borderRadius: 4,
|
|
256
|
-
backgroundColor: '#eee',
|
|
257
|
-
marginRight: 15,
|
|
258
|
-
},
|
|
259
|
-
backButtonText: {
|
|
260
|
-
color: '#333',
|
|
261
|
-
fontWeight: '500',
|
|
262
|
-
fontSize: 14,
|
|
263
|
-
},
|
|
264
|
-
headerActionTime: {
|
|
265
|
-
flexDirection: 'row',
|
|
266
|
-
alignItems: 'baseline',
|
|
267
|
-
},
|
|
268
|
-
headerAction: {
|
|
269
|
-
fontSize: 15,
|
|
270
|
-
fontWeight: 'bold',
|
|
271
|
-
marginRight: 8,
|
|
272
|
-
},
|
|
273
|
-
headerTimestamp: {
|
|
274
|
-
fontSize: 13,
|
|
275
|
-
color: '#666',
|
|
276
|
-
},
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
export default SubViewZustandLogs
|
package/lib/views/TabView.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
TouchableOpacity,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Animated,
|
|
8
|
-
} from 'react-native'
|
|
9
|
-
import { DebugColors } from '../utils/DebugConst'
|
|
10
|
-
|
|
11
|
-
const TabView = ({ tabs, activeTab, onTabChange, children }) => {
|
|
12
|
-
return (
|
|
13
|
-
<View style={styles.container}>
|
|
14
|
-
<View style={styles.tabBar}>
|
|
15
|
-
{tabs.map((tab, index) => (
|
|
16
|
-
<TouchableOpacity
|
|
17
|
-
key={index}
|
|
18
|
-
style={[styles.tab, activeTab === index && styles.activeTab]}
|
|
19
|
-
onPress={() => onTabChange(index)}>
|
|
20
|
-
<Text
|
|
21
|
-
style={[
|
|
22
|
-
styles.tabText,
|
|
23
|
-
activeTab === index && styles.activeTabText,
|
|
24
|
-
]}>
|
|
25
|
-
{tab.label}
|
|
26
|
-
</Text>
|
|
27
|
-
</TouchableOpacity>
|
|
28
|
-
))}
|
|
29
|
-
</View>
|
|
30
|
-
<View style={styles.content}>{children}</View>
|
|
31
|
-
</View>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const styles = StyleSheet.create({
|
|
36
|
-
container: {
|
|
37
|
-
flex: 1,
|
|
38
|
-
},
|
|
39
|
-
tabBar: {
|
|
40
|
-
flexDirection: 'row',
|
|
41
|
-
borderBottomWidth: 1,
|
|
42
|
-
borderBottomColor: DebugColors.border,
|
|
43
|
-
backgroundColor: DebugColors.background,
|
|
44
|
-
},
|
|
45
|
-
tab: {
|
|
46
|
-
flex: 1,
|
|
47
|
-
paddingVertical: 12,
|
|
48
|
-
alignItems: 'center',
|
|
49
|
-
},
|
|
50
|
-
activeTab: {
|
|
51
|
-
borderBottomWidth: 2,
|
|
52
|
-
borderBottomColor: DebugColors.blue,
|
|
53
|
-
},
|
|
54
|
-
tabText: {
|
|
55
|
-
color: DebugColors.textLight,
|
|
56
|
-
fontWeight: '500',
|
|
57
|
-
},
|
|
58
|
-
activeTabText: {
|
|
59
|
-
color: DebugColors.blue,
|
|
60
|
-
},
|
|
61
|
-
content: {
|
|
62
|
-
flex: 1,
|
|
63
|
-
},
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
export default TabView
|