react-native-debug-toolkit 2.0.0 → 2.2.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/README.md +82 -120
- package/README.zh-CN.md +171 -0
- package/lib/commonjs/core/DebugToolkit.js +117 -115
- package/lib/commonjs/core/DebugToolkit.js.map +1 -1
- package/lib/commonjs/core/DebugToolkitProvider.js +38 -30
- package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -1
- package/lib/commonjs/core/initialize.js +84 -0
- package/lib/commonjs/core/initialize.js.map +1 -0
- package/lib/commonjs/{components → features/clipboard}/ClipboardTab.js +16 -17
- package/lib/commonjs/features/clipboard/ClipboardTab.js.map +1 -0
- package/lib/commonjs/features/{ClipboardFeature.js → clipboard/index.js} +9 -5
- package/lib/commonjs/features/clipboard/index.js.map +1 -0
- package/lib/commonjs/features/console/ConsoleLogTab.js +162 -0
- package/lib/commonjs/features/console/ConsoleLogTab.js.map +1 -0
- package/lib/commonjs/features/console/index.js +118 -0
- package/lib/commonjs/features/console/index.js.map +1 -0
- package/lib/commonjs/{components → features/environment}/EnvironmentTab.js +24 -25
- package/lib/commonjs/features/environment/EnvironmentTab.js.map +1 -0
- package/lib/commonjs/features/{EnvironmentFeature.js → environment/index.js} +22 -25
- package/lib/commonjs/features/environment/index.js.map +1 -0
- package/lib/commonjs/{components → features/navigation}/NavigationLogTab.js +11 -10
- package/lib/commonjs/features/navigation/NavigationLogTab.js.map +1 -0
- package/lib/commonjs/features/navigation/index.js +39 -0
- package/lib/commonjs/features/navigation/index.js.map +1 -0
- package/lib/commonjs/{hooks → features/navigation}/useNavigationLogger.js +3 -3
- package/lib/commonjs/features/navigation/useNavigationLogger.js.map +1 -0
- package/lib/commonjs/features/network/NetworkLogTab.js +405 -0
- package/lib/commonjs/features/network/NetworkLogTab.js.map +1 -0
- package/lib/commonjs/features/network/index.js +96 -0
- package/lib/commonjs/features/network/index.js.map +1 -0
- package/lib/commonjs/features/network/networkInterceptor.js +261 -0
- package/lib/commonjs/features/network/networkInterceptor.js.map +1 -0
- package/lib/commonjs/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.js +10 -9
- package/lib/commonjs/features/thirdPartyLibs/ThirdPartyLibsTab.js.map +1 -0
- package/lib/commonjs/features/{ThirdPartyLibsFeature.js → thirdPartyLibs/index.js} +8 -8
- package/lib/commonjs/features/thirdPartyLibs/index.js.map +1 -0
- package/lib/commonjs/{native/NativeDebugLibs.js → features/thirdPartyLibs/nativeDebugLibs.js} +1 -1
- package/lib/commonjs/features/thirdPartyLibs/nativeDebugLibs.js.map +1 -0
- package/lib/commonjs/features/track/TrackLogTab.js +230 -0
- package/lib/commonjs/features/track/TrackLogTab.js.map +1 -0
- package/lib/commonjs/features/track/index.js +39 -0
- package/lib/commonjs/features/track/index.js.map +1 -0
- package/lib/commonjs/features/zustand/ZustandLogTab.js +311 -0
- package/lib/commonjs/features/zustand/ZustandLogTab.js.map +1 -0
- package/lib/commonjs/features/zustand/index.js +59 -0
- package/lib/commonjs/features/zustand/index.js.map +1 -0
- package/lib/commonjs/index.js +27 -40
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/environment.js +2 -0
- package/lib/commonjs/types/environment.js.map +1 -0
- package/lib/commonjs/types/feature.js +6 -0
- package/lib/commonjs/types/feature.js.map +1 -0
- package/lib/commonjs/types/index.js +0 -4
- package/lib/commonjs/types/logs.js +2 -0
- package/lib/commonjs/types/logs.js.map +1 -0
- package/lib/commonjs/types/navigation.js +2 -0
- package/lib/commonjs/types/navigation.js.map +1 -0
- package/lib/commonjs/types/thirdPartyLibs.js +2 -0
- package/lib/commonjs/types/thirdPartyLibs.js.map +1 -0
- package/lib/commonjs/ui/DebugView.js +66 -0
- package/lib/commonjs/ui/DebugView.js.map +1 -0
- package/lib/commonjs/ui/floating/FloatIcon.js +240 -0
- package/lib/commonjs/ui/floating/FloatIcon.js.map +1 -0
- package/lib/commonjs/ui/panel/DebugPanel.js +230 -0
- package/lib/commonjs/ui/panel/DebugPanel.js.map +1 -0
- package/lib/commonjs/ui/panel/FeatureTabBar.js +182 -0
- package/lib/commonjs/ui/panel/FeatureTabBar.js.map +1 -0
- package/lib/commonjs/ui/panel/FloatPanelView.js +238 -0
- package/lib/commonjs/ui/panel/FloatPanelView.js.map +1 -0
- package/lib/commonjs/{components → ui}/shared/CollapsibleSection.js +4 -4
- package/lib/commonjs/ui/shared/CollapsibleSection.js.map +1 -0
- package/lib/commonjs/{components → ui}/shared/CopyButton.js +3 -3
- package/lib/commonjs/ui/shared/CopyButton.js.map +1 -0
- package/lib/commonjs/ui/shared/JsonView.js.map +1 -0
- package/lib/commonjs/ui/shared/LogListScreen.js +174 -0
- package/lib/commonjs/ui/shared/LogListScreen.js.map +1 -0
- package/lib/commonjs/ui/shared/useSlideDetailAnimation.js.map +1 -0
- package/lib/commonjs/ui/theme/colors.js +43 -0
- package/lib/commonjs/ui/theme/colors.js.map +1 -0
- package/lib/commonjs/ui/theme/layout.js +8 -0
- package/lib/commonjs/ui/theme/layout.js.map +1 -0
- package/lib/commonjs/utils/createChannelFeature.js +62 -0
- package/lib/commonjs/utils/createChannelFeature.js.map +1 -0
- package/lib/commonjs/utils/createObservableStore.js +5 -0
- package/lib/commonjs/utils/createObservableStore.js.map +1 -1
- package/lib/commonjs/utils/createPersistedObservableStore.js +71 -0
- package/lib/commonjs/utils/createPersistedObservableStore.js.map +1 -0
- package/lib/commonjs/utils/debugPreferences.js +52 -0
- package/lib/commonjs/utils/debugPreferences.js.map +1 -0
- package/lib/commonjs/utils/urlRewriterRegistry.js +14 -0
- package/lib/commonjs/utils/urlRewriterRegistry.js.map +1 -0
- package/lib/module/core/DebugToolkit.js +117 -114
- package/lib/module/core/DebugToolkit.js.map +1 -1
- package/lib/module/core/DebugToolkitProvider.js +39 -31
- package/lib/module/core/DebugToolkitProvider.js.map +1 -1
- package/lib/module/core/initialize.js +80 -0
- package/lib/module/core/initialize.js.map +1 -0
- package/lib/module/{components → features/clipboard}/ClipboardTab.js +9 -9
- package/lib/module/features/clipboard/ClipboardTab.js.map +1 -0
- package/lib/module/features/clipboard/index.js +16 -0
- package/lib/module/features/clipboard/index.js.map +1 -0
- package/lib/module/features/console/ConsoleLogTab.js +157 -0
- package/lib/module/features/console/ConsoleLogTab.js.map +1 -0
- package/lib/module/features/console/index.js +112 -0
- package/lib/module/features/console/index.js.map +1 -0
- package/lib/module/{components → features/environment}/EnvironmentTab.js +5 -5
- package/lib/module/features/environment/EnvironmentTab.js.map +1 -0
- package/lib/module/features/{EnvironmentFeature.js → environment/index.js} +22 -25
- package/lib/module/features/environment/index.js.map +1 -0
- package/lib/module/{components → features/navigation}/NavigationLogTab.js +4 -3
- package/lib/module/features/navigation/NavigationLogTab.js.map +1 -0
- package/lib/module/features/navigation/index.js +32 -0
- package/lib/module/features/navigation/index.js.map +1 -0
- package/lib/module/{hooks → features/navigation}/useNavigationLogger.js +2 -2
- package/lib/module/features/navigation/useNavigationLogger.js.map +1 -0
- package/lib/module/features/network/NetworkLogTab.js +400 -0
- package/lib/module/features/network/NetworkLogTab.js.map +1 -0
- package/lib/module/features/network/index.js +90 -0
- package/lib/module/features/network/index.js.map +1 -0
- package/lib/module/features/network/networkInterceptor.js +256 -0
- package/lib/module/features/network/networkInterceptor.js.map +1 -0
- package/lib/module/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.js +3 -2
- package/lib/module/features/thirdPartyLibs/ThirdPartyLibsTab.js.map +1 -0
- package/lib/module/features/{ThirdPartyLibsFeature.js → thirdPartyLibs/index.js} +4 -4
- package/lib/module/features/thirdPartyLibs/index.js.map +1 -0
- package/lib/module/{native/NativeDebugLibs.js → features/thirdPartyLibs/nativeDebugLibs.js} +1 -1
- package/lib/module/features/thirdPartyLibs/nativeDebugLibs.js.map +1 -0
- package/lib/module/features/track/TrackLogTab.js +225 -0
- package/lib/module/features/track/TrackLogTab.js.map +1 -0
- package/lib/module/features/track/index.js +32 -0
- package/lib/module/features/track/index.js.map +1 -0
- package/lib/module/features/zustand/ZustandLogTab.js +306 -0
- package/lib/module/features/zustand/ZustandLogTab.js.map +1 -0
- package/lib/module/features/zustand/index.js +53 -0
- package/lib/module/features/zustand/index.js.map +1 -0
- package/lib/module/index.js +11 -12
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/environment.js +2 -0
- package/lib/module/types/environment.js.map +1 -0
- package/lib/module/types/feature.js +4 -0
- package/lib/module/types/feature.js.map +1 -0
- package/lib/module/types/index.js +0 -2
- package/lib/module/types/logs.js +2 -0
- package/lib/module/types/logs.js.map +1 -0
- package/lib/module/types/navigation.js +2 -0
- package/lib/module/types/navigation.js.map +1 -0
- package/lib/module/types/thirdPartyLibs.js +2 -0
- package/lib/module/types/thirdPartyLibs.js.map +1 -0
- package/lib/module/ui/DebugView.js +61 -0
- package/lib/module/ui/DebugView.js.map +1 -0
- package/lib/module/ui/floating/FloatIcon.js +235 -0
- package/lib/module/ui/floating/FloatIcon.js.map +1 -0
- package/lib/module/ui/panel/DebugPanel.js +225 -0
- package/lib/module/ui/panel/DebugPanel.js.map +1 -0
- package/lib/module/ui/panel/FeatureTabBar.js +177 -0
- package/lib/module/ui/panel/FeatureTabBar.js.map +1 -0
- package/lib/module/ui/panel/FloatPanelView.js +233 -0
- package/lib/module/ui/panel/FloatPanelView.js.map +1 -0
- package/lib/module/{components → ui}/shared/CollapsibleSection.js +1 -1
- package/lib/module/ui/shared/CollapsibleSection.js.map +1 -0
- package/lib/module/{components → ui}/shared/CopyButton.js +1 -1
- package/lib/module/ui/shared/CopyButton.js.map +1 -0
- package/lib/module/ui/shared/JsonView.js.map +1 -0
- package/lib/module/ui/shared/LogListScreen.js +169 -0
- package/lib/module/ui/shared/LogListScreen.js.map +1 -0
- package/lib/module/ui/shared/useSlideDetailAnimation.js.map +1 -0
- package/lib/module/ui/theme/colors.js +38 -0
- package/lib/module/ui/theme/colors.js.map +1 -0
- package/lib/module/ui/theme/layout.js +4 -0
- package/lib/module/ui/theme/layout.js.map +1 -0
- package/lib/module/utils/createChannelFeature.js +58 -0
- package/lib/module/utils/createChannelFeature.js.map +1 -0
- package/lib/module/utils/createObservableStore.js +5 -0
- package/lib/module/utils/createObservableStore.js.map +1 -1
- package/lib/module/utils/createPersistedObservableStore.js +67 -0
- package/lib/module/utils/createPersistedObservableStore.js.map +1 -0
- package/lib/module/utils/debugPreferences.js +46 -0
- package/lib/module/utils/debugPreferences.js.map +1 -0
- package/lib/module/utils/urlRewriterRegistry.js +10 -0
- package/lib/module/utils/urlRewriterRegistry.js.map +1 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts +17 -20
- package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -1
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts +4 -7
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -1
- package/lib/typescript/src/core/initialize.d.ts +32 -0
- package/lib/typescript/src/core/initialize.d.ts.map +1 -0
- package/lib/typescript/src/features/clipboard/ClipboardTab.d.ts +4 -0
- package/lib/typescript/src/features/clipboard/ClipboardTab.d.ts.map +1 -0
- package/lib/typescript/src/features/clipboard/index.d.ts +7 -0
- package/lib/typescript/src/features/clipboard/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/console}/ConsoleLogTab.d.ts +2 -2
- package/lib/typescript/src/features/console/ConsoleLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/console/index.d.ts +9 -0
- package/lib/typescript/src/features/console/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/environment}/EnvironmentTab.d.ts +1 -1
- package/lib/typescript/src/features/environment/EnvironmentTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{EnvironmentFeature.d.ts → environment/index.d.ts} +2 -2
- package/lib/typescript/src/features/environment/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/navigation}/NavigationLogTab.d.ts +2 -2
- package/lib/typescript/src/features/navigation/NavigationLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{NavigationLogFeature.d.ts → navigation/index.d.ts} +5 -3
- package/lib/typescript/src/features/navigation/index.d.ts.map +1 -0
- package/lib/typescript/src/{hooks → features/navigation}/useNavigationLogger.d.ts +1 -8
- package/lib/typescript/src/features/navigation/useNavigationLogger.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/network}/NetworkLogTab.d.ts +2 -2
- package/lib/typescript/src/features/network/NetworkLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/network/index.d.ts +15 -0
- package/lib/typescript/src/features/network/index.d.ts.map +1 -0
- package/lib/typescript/src/features/network/networkInterceptor.d.ts +19 -0
- package/lib/typescript/src/features/network/networkInterceptor.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.d.ts +2 -2
- package/lib/typescript/src/features/thirdPartyLibs/ThirdPartyLibsTab.d.ts.map +1 -0
- package/lib/typescript/src/features/thirdPartyLibs/index.d.ts +3 -0
- package/lib/typescript/src/features/thirdPartyLibs/index.d.ts.map +1 -0
- package/lib/typescript/src/{native/NativeDebugLibs.d.ts → features/thirdPartyLibs/nativeDebugLibs.d.ts} +1 -1
- package/lib/typescript/src/features/thirdPartyLibs/nativeDebugLibs.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/track}/TrackLogTab.d.ts +2 -2
- package/lib/typescript/src/features/track/TrackLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{TrackFeature.d.ts → track/index.d.ts} +5 -3
- package/lib/typescript/src/features/track/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/zustand}/ZustandLogTab.d.ts +2 -2
- package/lib/typescript/src/features/zustand/ZustandLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{ZustandLogFeature.d.ts → zustand/index.d.ts} +5 -3
- package/lib/typescript/src/features/zustand/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +20 -20
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/environment.d.ts +11 -0
- package/lib/typescript/src/types/environment.d.ts.map +1 -0
- package/lib/typescript/src/types/feature.d.ts +23 -0
- package/lib/typescript/src/types/feature.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +5 -111
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/logs.d.ts +51 -0
- package/lib/typescript/src/types/logs.d.ts.map +1 -0
- package/lib/typescript/src/types/navigation.d.ts +8 -0
- package/lib/typescript/src/types/navigation.d.ts.map +1 -0
- package/lib/typescript/src/types/thirdPartyLibs.d.ts +13 -0
- package/lib/typescript/src/types/thirdPartyLibs.d.ts.map +1 -0
- package/lib/typescript/src/ui/DebugView.d.ts +19 -0
- package/lib/typescript/src/ui/DebugView.d.ts.map +1 -0
- package/lib/typescript/src/ui/floating/FloatIcon.d.ts +12 -0
- package/lib/typescript/src/ui/floating/FloatIcon.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts +9 -0
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/FeatureTabBar.d.ts +13 -0
- package/lib/typescript/src/ui/panel/FeatureTabBar.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/FloatPanelView.d.ts +12 -0
- package/lib/typescript/src/ui/panel/FloatPanelView.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/CollapsibleSection.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/CopyButton.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/JsonView.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/LogListScreen.d.ts +21 -0
- package/lib/typescript/src/ui/shared/LogListScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/useSlideDetailAnimation.d.ts.map +1 -0
- package/lib/typescript/src/ui/theme/colors.d.ts +21 -0
- package/lib/typescript/src/ui/theme/colors.d.ts.map +1 -0
- package/lib/typescript/src/ui/theme/layout.d.ts +2 -0
- package/lib/typescript/src/ui/theme/layout.d.ts.map +1 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts +27 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts.map +1 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts +1 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -1
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts +15 -0
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts.map +1 -0
- package/lib/typescript/src/utils/debugPreferences.d.ts +10 -0
- package/lib/typescript/src/utils/debugPreferences.d.ts.map +1 -0
- package/lib/typescript/src/utils/urlRewriterRegistry.d.ts +7 -0
- package/lib/typescript/src/utils/urlRewriterRegistry.d.ts.map +1 -0
- package/package.json +5 -1
- package/src/core/DebugToolkit.tsx +144 -142
- package/src/core/DebugToolkitProvider.tsx +44 -43
- package/src/core/initialize.ts +122 -0
- package/src/{components → features/clipboard}/ClipboardTab.tsx +10 -10
- package/src/features/clipboard/index.ts +15 -0
- package/src/features/console/ConsoleLogTab.tsx +95 -0
- package/src/features/console/index.ts +119 -0
- package/src/{components → features/environment}/EnvironmentTab.tsx +7 -7
- package/src/features/{EnvironmentFeature.ts → environment/index.ts} +27 -25
- package/src/{components → features/navigation}/NavigationLogTab.tsx +6 -5
- package/src/features/navigation/index.ts +44 -0
- package/src/{hooks → features/navigation}/useNavigationLogger.ts +3 -8
- package/src/features/network/NetworkLogTab.tsx +271 -0
- package/src/features/network/index.ts +113 -0
- package/src/features/network/networkInterceptor.ts +311 -0
- package/src/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.tsx +6 -5
- package/src/features/{ThirdPartyLibsFeature.ts → thirdPartyLibs/index.ts} +5 -5
- package/src/features/track/TrackLogTab.tsx +110 -0
- package/src/features/track/index.ts +41 -0
- package/src/features/zustand/ZustandLogTab.tsx +203 -0
- package/src/features/{ZustandLogFeature.ts → zustand/index.ts} +19 -45
- package/src/index.ts +20 -24
- package/src/types/environment.ts +11 -0
- package/src/types/feature.ts +32 -0
- package/src/types/index.ts +29 -138
- package/src/types/logs.ts +54 -0
- package/src/types/navigation.ts +5 -0
- package/src/types/thirdPartyLibs.ts +13 -0
- package/src/ui/DebugView.tsx +80 -0
- package/src/ui/floating/FloatIcon.tsx +202 -0
- package/src/ui/panel/DebugPanel.tsx +215 -0
- package/src/ui/panel/FeatureTabBar.tsx +204 -0
- package/src/ui/panel/FloatPanelView.tsx +227 -0
- package/src/{components → ui}/shared/CollapsibleSection.tsx +1 -1
- package/src/{components → ui}/shared/CopyButton.tsx +1 -1
- package/src/ui/shared/LogListScreen.tsx +164 -0
- package/src/ui/theme/colors.ts +33 -0
- package/src/ui/theme/layout.ts +1 -0
- package/src/utils/createChannelFeature.ts +80 -0
- package/src/utils/createObservableStore.ts +6 -0
- package/src/utils/createPersistedObservableStore.ts +76 -0
- package/src/utils/debugPreferences.ts +48 -0
- package/src/utils/urlRewriterRegistry.ts +10 -0
- package/lib/commonjs/components/ClipboardTab.js.map +0 -1
- package/lib/commonjs/components/ConsoleLogTab.js +0 -295
- package/lib/commonjs/components/ConsoleLogTab.js.map +0 -1
- package/lib/commonjs/components/EnvironmentTab.js.map +0 -1
- package/lib/commonjs/components/FloatPanelView.js +0 -797
- package/lib/commonjs/components/FloatPanelView.js.map +0 -1
- package/lib/commonjs/components/NavigationLogTab.js.map +0 -1
- package/lib/commonjs/components/NetworkLogTab.js +0 -575
- package/lib/commonjs/components/NetworkLogTab.js.map +0 -1
- package/lib/commonjs/components/ThirdPartyLibsTab.js.map +0 -1
- package/lib/commonjs/components/TrackLogTab.js +0 -372
- package/lib/commonjs/components/TrackLogTab.js.map +0 -1
- package/lib/commonjs/components/ZustandLogTab.js +0 -451
- package/lib/commonjs/components/ZustandLogTab.js.map +0 -1
- package/lib/commonjs/components/shared/CollapsibleSection.js.map +0 -1
- package/lib/commonjs/components/shared/CopyButton.js.map +0 -1
- package/lib/commonjs/components/shared/JsonView.js.map +0 -1
- package/lib/commonjs/features/ClipboardFeature.js.map +0 -1
- package/lib/commonjs/features/ConsoleLogFeature.js +0 -98
- package/lib/commonjs/features/ConsoleLogFeature.js.map +0 -1
- package/lib/commonjs/features/EnvironmentFeature.js.map +0 -1
- package/lib/commonjs/features/NavigationLogFeature.js +0 -60
- package/lib/commonjs/features/NavigationLogFeature.js.map +0 -1
- package/lib/commonjs/features/NetworkFeature.js +0 -328
- package/lib/commonjs/features/NetworkFeature.js.map +0 -1
- package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +0 -1
- package/lib/commonjs/features/TrackFeature.js +0 -55
- package/lib/commonjs/features/TrackFeature.js.map +0 -1
- package/lib/commonjs/features/ZustandLogFeature.js +0 -76
- package/lib/commonjs/features/ZustandLogFeature.js.map +0 -1
- package/lib/commonjs/hooks/useNavigationLogger.js.map +0 -1
- package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +0 -1
- package/lib/commonjs/initialize.js +0 -161
- package/lib/commonjs/initialize.js.map +0 -1
- package/lib/commonjs/native/NativeDebugLibs.js.map +0 -1
- package/lib/commonjs/utils/constants.js +0 -135
- package/lib/commonjs/utils/constants.js.map +0 -1
- package/lib/module/components/ClipboardTab.js.map +0 -1
- package/lib/module/components/ConsoleLogTab.js +0 -290
- package/lib/module/components/ConsoleLogTab.js.map +0 -1
- package/lib/module/components/EnvironmentTab.js.map +0 -1
- package/lib/module/components/FloatPanelView.js +0 -791
- package/lib/module/components/FloatPanelView.js.map +0 -1
- package/lib/module/components/NavigationLogTab.js.map +0 -1
- package/lib/module/components/NetworkLogTab.js +0 -570
- package/lib/module/components/NetworkLogTab.js.map +0 -1
- package/lib/module/components/ThirdPartyLibsTab.js.map +0 -1
- package/lib/module/components/TrackLogTab.js +0 -367
- package/lib/module/components/TrackLogTab.js.map +0 -1
- package/lib/module/components/ZustandLogTab.js +0 -446
- package/lib/module/components/ZustandLogTab.js.map +0 -1
- package/lib/module/components/shared/CollapsibleSection.js.map +0 -1
- package/lib/module/components/shared/CopyButton.js.map +0 -1
- package/lib/module/components/shared/JsonView.js.map +0 -1
- package/lib/module/features/ClipboardFeature.js +0 -12
- package/lib/module/features/ClipboardFeature.js.map +0 -1
- package/lib/module/features/ConsoleLogFeature.js +0 -93
- package/lib/module/features/ConsoleLogFeature.js.map +0 -1
- package/lib/module/features/EnvironmentFeature.js.map +0 -1
- package/lib/module/features/NavigationLogFeature.js +0 -54
- package/lib/module/features/NavigationLogFeature.js.map +0 -1
- package/lib/module/features/NetworkFeature.js +0 -322
- package/lib/module/features/NetworkFeature.js.map +0 -1
- package/lib/module/features/ThirdPartyLibsFeature.js.map +0 -1
- package/lib/module/features/TrackFeature.js +0 -49
- package/lib/module/features/TrackFeature.js.map +0 -1
- package/lib/module/features/ZustandLogFeature.js +0 -69
- package/lib/module/features/ZustandLogFeature.js.map +0 -1
- package/lib/module/hooks/useNavigationLogger.js.map +0 -1
- package/lib/module/hooks/useSlideDetailAnimation.js.map +0 -1
- package/lib/module/initialize.js +0 -156
- package/lib/module/initialize.js.map +0 -1
- package/lib/module/native/NativeDebugLibs.js.map +0 -1
- package/lib/module/utils/constants.js +0 -130
- package/lib/module/utils/constants.js.map +0 -1
- package/lib/typescript/src/components/ClipboardTab.d.ts +0 -4
- package/lib/typescript/src/components/ClipboardTab.d.ts.map +0 -1
- package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/EnvironmentTab.d.ts.map +0 -1
- package/lib/typescript/src/components/FloatPanelView.d.ts +0 -64
- package/lib/typescript/src/components/FloatPanelView.d.ts.map +0 -1
- package/lib/typescript/src/components/NavigationLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/NetworkLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +0 -1
- package/lib/typescript/src/components/TrackLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/ZustandLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/CopyButton.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/JsonView.d.ts.map +0 -1
- package/lib/typescript/src/features/ClipboardFeature.d.ts +0 -3
- package/lib/typescript/src/features/ClipboardFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts +0 -7
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/NetworkFeature.d.ts +0 -28
- package/lib/typescript/src/features/NetworkFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +0 -3
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/TrackFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +0 -1
- package/lib/typescript/src/initialize.d.ts +0 -51
- package/lib/typescript/src/initialize.d.ts.map +0 -1
- package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +0 -1
- package/lib/typescript/src/utils/constants.d.ts +0 -96
- package/lib/typescript/src/utils/constants.d.ts.map +0 -1
- package/src/components/ConsoleLogTab.tsx +0 -209
- package/src/components/FloatPanelView.tsx +0 -714
- package/src/components/NetworkLogTab.tsx +0 -411
- package/src/components/TrackLogTab.tsx +0 -245
- package/src/components/ZustandLogTab.tsx +0 -305
- package/src/features/ClipboardFeature.ts +0 -11
- package/src/features/ConsoleLogFeature.ts +0 -118
- package/src/features/NavigationLogFeature.ts +0 -74
- package/src/features/NetworkFeature.ts +0 -488
- package/src/features/TrackFeature.ts +0 -69
- package/src/initialize.ts +0 -214
- package/src/utils/constants.ts +0 -91
- /package/lib/commonjs/{components → ui}/shared/JsonView.js +0 -0
- /package/lib/commonjs/{hooks → ui/shared}/useSlideDetailAnimation.js +0 -0
- /package/lib/module/{components → ui}/shared/JsonView.js +0 -0
- /package/lib/module/{hooks → ui/shared}/useSlideDetailAnimation.js +0 -0
- /package/lib/typescript/src/{components → ui}/shared/CollapsibleSection.d.ts +0 -0
- /package/lib/typescript/src/{components → ui}/shared/CopyButton.d.ts +0 -0
- /package/lib/typescript/src/{components → ui}/shared/JsonView.d.ts +0 -0
- /package/lib/typescript/src/{hooks → ui/shared}/useSlideDetailAnimation.d.ts +0 -0
- /package/src/{native/NativeDebugLibs.ts → features/thirdPartyLibs/nativeDebugLibs.ts} +0 -0
- /package/src/{components → ui}/shared/JsonView.tsx +0 -0
- /package/src/{hooks → ui/shared}/useSlideDetailAnimation.ts +0 -0
package/README.md
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
# React Native Debug Toolkit
|
|
2
2
|
|
|
3
|
+
[中文文档](README.zh-CN.md)
|
|
4
|
+
|
|
3
5
|
A dev-only floating debug panel for React Native — inspect network, console, state, navigation and more, right on your device.
|
|
4
6
|
|
|
5
7
|
> Zero impact on production builds (`__DEV__` only).
|
|
6
8
|
|
|
9
|
+
## Preview
|
|
10
|
+
|
|
11
|
+

|
|
7
12
|
## Features
|
|
8
13
|
|
|
9
|
-
- **Network** —
|
|
14
|
+
- **Network** — Auto-intercepts fetch; axios via `axiosInstance` config, inspect requests & responses, copy as cURL
|
|
10
15
|
- **Console** — Capture `console.log / info / warn / error`
|
|
11
16
|
- **Zustand** — Log state transitions via middleware
|
|
12
17
|
- **Navigation** — Track route changes
|
|
13
18
|
- **Track** — Record custom analytics events
|
|
14
19
|
- **Environment** — Switch API hosts on the fly
|
|
15
|
-
- **Clipboard** —
|
|
16
|
-
- **
|
|
17
|
-
- **Export** — Share debug data via system share sheet
|
|
20
|
+
- **Clipboard** — Paste text and copy to computer
|
|
21
|
+
- **Log Persistence** — Network, Console, Track logs survive app restarts (requires AsyncStorage)
|
|
18
22
|
|
|
19
23
|
## Installation
|
|
20
24
|
|
|
@@ -28,76 +32,75 @@ Optional — clipboard copy support:
|
|
|
28
32
|
npm install @react-native-clipboard/clipboard
|
|
29
33
|
```
|
|
30
34
|
|
|
35
|
+
Optional — FAB position & last tab persistence:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @react-native-async-storage/async-storage
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Without AsyncStorage these features degrade gracefully to in-memory state.
|
|
42
|
+
|
|
31
43
|
## Quick Start
|
|
32
44
|
|
|
33
45
|
```tsx
|
|
34
|
-
import {
|
|
35
|
-
import { initializeDebugToolkit } from 'react-native-debug-toolkit';
|
|
46
|
+
import { DebugView } from 'react-native-debug-toolkit';
|
|
36
47
|
|
|
37
48
|
function App() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return <AppContent />;
|
|
49
|
+
return (
|
|
50
|
+
<DebugView>
|
|
51
|
+
<AppContent />
|
|
52
|
+
</DebugView>
|
|
53
|
+
);
|
|
44
54
|
}
|
|
45
55
|
```
|
|
46
56
|
|
|
47
|
-
|
|
57
|
+
A floating debug button appears in dev mode. Tap to open the panel, tap × or swipe down to close.
|
|
48
58
|
|
|
49
|
-
|
|
59
|
+
Network (fetch), console, navigation, zustand, track, and clipboard are enabled by default. To capture axios requests, pass your axios instance via the `axiosInstance` config option.
|
|
50
60
|
|
|
51
|
-
|
|
61
|
+
Disable specific features:
|
|
52
62
|
|
|
53
63
|
```tsx
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
console: true,
|
|
58
|
-
zustand: true,
|
|
59
|
-
track: true,
|
|
60
|
-
environment: [
|
|
61
|
-
{ id: 'dev', label: 'Dev', host: 'dev-api.example.com', color: '#34C759' },
|
|
62
|
-
{ id: 'prod', label: 'Prod', host: 'api.example.com', color: '#FF3B30' },
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
enabled: true, // force enable (default: __DEV__)
|
|
66
|
-
});
|
|
64
|
+
<DebugView features={{ clipboard: false, zustand: false }}>
|
|
65
|
+
<AppContent />
|
|
66
|
+
</DebugView>
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
### Per-feature options
|
|
69
|
+
## Common Patterns
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
|---------|---------|
|
|
75
|
-
| `network` | `maxLogs`, `blacklist` |
|
|
76
|
-
| `console` | `maxLogs` |
|
|
77
|
-
| `zustand` | `maxLogs` |
|
|
78
|
-
| `navigation` | `maxLogs` |
|
|
79
|
-
| `track` | `maxLogs` |
|
|
80
|
-
| `environment` | `EnvironmentConfig[]` |
|
|
81
|
-
| `thirdPartyLibs` | — |
|
|
82
|
-
| `clipboard` | — |
|
|
71
|
+
### Navigation Tracking
|
|
83
72
|
|
|
84
|
-
|
|
73
|
+
```tsx
|
|
74
|
+
import { useRef } from 'react';
|
|
75
|
+
import { DebugView } from 'react-native-debug-toolkit';
|
|
76
|
+
import { NavigationContainer } from '@react-navigation/native';
|
|
85
77
|
|
|
86
|
-
|
|
78
|
+
function App() {
|
|
79
|
+
const navRef = useRef(null);
|
|
80
|
+
return (
|
|
81
|
+
<DebugView navigationRef={navRef}>
|
|
82
|
+
<NavigationContainer ref={navRef}>
|
|
83
|
+
<AppContent />
|
|
84
|
+
</NavigationContainer>
|
|
85
|
+
</DebugView>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
87
89
|
|
|
88
|
-
###
|
|
90
|
+
### Environment Switching
|
|
89
91
|
|
|
90
92
|
```tsx
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
<DebugView
|
|
94
|
+
environments={[
|
|
95
|
+
{ id: 'dev', label: 'Dev', host: 'dev-api.example.com', color: '#34C759' },
|
|
96
|
+
{ id: 'prod', label: 'Prod', host: 'api.example.com', color: '#FF3B30' },
|
|
97
|
+
]}
|
|
98
|
+
>
|
|
99
|
+
<AppContent />
|
|
100
|
+
</DebugView>
|
|
98
101
|
```
|
|
99
102
|
|
|
100
|
-
### Zustand
|
|
103
|
+
### Zustand Middleware
|
|
101
104
|
|
|
102
105
|
```tsx
|
|
103
106
|
import { zustandLogMiddleware } from 'react-native-debug-toolkit';
|
|
@@ -106,21 +109,12 @@ const useStore = create(
|
|
|
106
109
|
zustandLogMiddleware((set) => ({
|
|
107
110
|
count: 0,
|
|
108
111
|
increment: () => set((s) => ({ count: s.count + 1 }), false, 'increment'),
|
|
112
|
+
// ↑ merge ↑ action name (shown in debug panel)
|
|
109
113
|
}))
|
|
110
114
|
);
|
|
111
115
|
```
|
|
112
116
|
|
|
113
|
-
###
|
|
114
|
-
|
|
115
|
-
```tsx
|
|
116
|
-
import { useNavigationLogger } from 'react-native-debug-toolkit';
|
|
117
|
-
|
|
118
|
-
const ref = useRef(null);
|
|
119
|
-
useNavigationLogger(ref);
|
|
120
|
-
// pass ref to <NavigationContainer ref={ref}>
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Custom events
|
|
117
|
+
### Custom Events
|
|
124
118
|
|
|
125
119
|
```tsx
|
|
126
120
|
import { addTrackLog } from 'react-native-debug-toolkit';
|
|
@@ -128,73 +122,40 @@ import { addTrackLog } from 'react-native-debug-toolkit';
|
|
|
128
122
|
addTrackLog({ eventName: 'button_click', buttonId: 'submit' });
|
|
129
123
|
```
|
|
130
124
|
|
|
131
|
-
###
|
|
132
|
-
|
|
133
|
-
Tap **Export** in the panel header, or call programmatically:
|
|
134
|
-
|
|
135
|
-
```tsx
|
|
136
|
-
import { exportDebugData } from 'react-native-debug-toolkit';
|
|
137
|
-
|
|
138
|
-
await exportDebugData(data, 'network');
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Copy to computer
|
|
125
|
+
### Network Blacklist & Axios
|
|
142
126
|
|
|
143
127
|
```tsx
|
|
144
|
-
import
|
|
145
|
-
|
|
146
|
-
await copyToComputer(jsonString);
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## API
|
|
150
|
-
|
|
151
|
-
### `initializeDebugToolkit(config?)`
|
|
128
|
+
import axios from 'axios';
|
|
152
129
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
130
|
+
const api = axios.create({ baseURL: 'https://api.example.com' });
|
|
131
|
+
|
|
132
|
+
<DebugView
|
|
133
|
+
features={{
|
|
134
|
+
network: {
|
|
135
|
+
maxLogs: 100,
|
|
136
|
+
blacklist: ['/analytics', /\/healthcheck$/],
|
|
137
|
+
axiosInstance: api,
|
|
138
|
+
},
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
<AppContent />
|
|
142
|
+
</DebugView>
|
|
159
143
|
```
|
|
160
144
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
| Method | Description |
|
|
164
|
-
|--------|-------------|
|
|
165
|
-
| `showPanel()` / `hidePanel()` | Toggle visibility |
|
|
166
|
-
| `clearAll()` | Clear all data |
|
|
167
|
-
| `addFeature(f)` / `removeFeature(name)` | Manage features at runtime |
|
|
168
|
-
| `destroy()` | Full teardown |
|
|
169
|
-
| `features` | Active features (read-only) |
|
|
145
|
+
## Imperative API
|
|
170
146
|
|
|
171
|
-
|
|
147
|
+
For programmatic control outside React (notifications, deep links, dev-only buttons):
|
|
172
148
|
|
|
173
149
|
```tsx
|
|
174
|
-
import
|
|
175
|
-
|
|
176
|
-
const myFeature: DebugFeature<MyData> = {
|
|
177
|
-
name: 'myFeature',
|
|
178
|
-
label: 'My Feature',
|
|
179
|
-
setup: () => { /* start capturing */ },
|
|
180
|
-
getData: () => myDataArray,
|
|
181
|
-
cleanup: () => { /* stop capturing */ },
|
|
182
|
-
clear: () => { /* reset data */ },
|
|
183
|
-
subscribe: (cb) => { emitter.on('change', cb); return () => emitter.off('change', cb); },
|
|
184
|
-
renderContent: MyFeatureTab,
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
initializeDebugToolkit({ features: { myFeature } });
|
|
188
|
-
```
|
|
150
|
+
import { DebugToolkit } from 'react-native-debug-toolkit';
|
|
189
151
|
|
|
190
|
-
|
|
152
|
+
DebugToolkit.openPanel();
|
|
153
|
+
DebugToolkit.clearAll();
|
|
154
|
+
DebugToolkit.showLauncher();
|
|
155
|
+
DebugToolkit.hideLauncher();
|
|
156
|
+
```
|
|
191
157
|
|
|
192
|
-
|
|
193
|
-
|--------|-------------|
|
|
194
|
-
| `safeStringify(value, space?)` | JSON stringify with circular-ref protection |
|
|
195
|
-
| `exportDebugData(data, name)` | Share via system sheet |
|
|
196
|
-
| `copyToComputer(content, options?)` | Copy content to computer |
|
|
197
|
-
| `logToComputer(...args)` | Log to computer console |
|
|
158
|
+
Full API: `DebugToolkit` is a singleton with `openPanel`, `closePanel`, `togglePanel`, `clearAll`, `showLauncher`, `hideLauncher`, `addFeature`, `removeFeature`, `destroy`, `features`, `panelOpen`. See TypeScript types for details.
|
|
198
159
|
|
|
199
160
|
## Peer Dependencies
|
|
200
161
|
|
|
@@ -203,6 +164,7 @@ initializeDebugToolkit({ features: { myFeature } });
|
|
|
203
164
|
| react | >= 18.0.0 | Yes |
|
|
204
165
|
| react-native | >= 0.72.0 | Yes |
|
|
205
166
|
| @react-native-clipboard/clipboard | >= 1.0.0 | No |
|
|
167
|
+
| @react-native-async-storage/async-storage | >= 1.0.0 | No |
|
|
206
168
|
|
|
207
169
|
## License
|
|
208
170
|
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# React Native Debug Toolkit
|
|
2
|
+
|
|
3
|
+
[English](README.md)
|
|
4
|
+
|
|
5
|
+
一个仅用于开发的 React Native 浮动调试面板 — 在设备上直接查看网络请求、控制台日志、状态变化、导航事件等。
|
|
6
|
+
|
|
7
|
+
> 生产环境零影响(仅在 `__DEV__` 模式下运行)。
|
|
8
|
+
|
|
9
|
+
## 预览
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
## 功能
|
|
13
|
+
|
|
14
|
+
- **Network** — 自动拦截 fetch;axios 通过 `axiosInstance` 配置,查看请求与响应,复制为 cURL
|
|
15
|
+
- **Console** — 捕获 `console.log / info / warn / error`
|
|
16
|
+
- **Zustand** — 通过中间件记录状态变化
|
|
17
|
+
- **Navigation** — 追踪路由切换
|
|
18
|
+
- **Track** — 记录自定义埋点事件
|
|
19
|
+
- **Environment** — 运行时切换 API 环境
|
|
20
|
+
- **Clipboard** — 粘贴文本并复制到电脑
|
|
21
|
+
- **日志持久化** — Network、Console、Track 日志在应用重启后保留(需要 AsyncStorage)
|
|
22
|
+
|
|
23
|
+
## 安装
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install react-native-debug-toolkit
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
可选 — 剪贴板复制支持:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @react-native-clipboard/clipboard
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
可选 — FAB 位置与上次 Tab 持久化:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @react-native-async-storage/async-storage
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
未安装 AsyncStorage 时,这些功能会优雅降级为内存态。
|
|
42
|
+
|
|
43
|
+
## 快速开始
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { DebugView } from 'react-native-debug-toolkit';
|
|
47
|
+
|
|
48
|
+
function App() {
|
|
49
|
+
return (
|
|
50
|
+
<DebugView>
|
|
51
|
+
<AppContent />
|
|
52
|
+
</DebugView>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
开发模式下出现浮动调试按钮。点击打开面板,点击 × 或下滑关闭。
|
|
58
|
+
|
|
59
|
+
网络(fetch)、控制台、导航、Zustand、埋点和剪贴板默认启用。如需捕获 axios 请求,通过 `axiosInstance` 配置项传入你的 axios 实例。
|
|
60
|
+
|
|
61
|
+
禁用特定功能:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<DebugView features={{ clipboard: false, zustand: false }}>
|
|
65
|
+
<AppContent />
|
|
66
|
+
</DebugView>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 常用模式
|
|
70
|
+
|
|
71
|
+
### 导航追踪
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { useRef } from 'react';
|
|
75
|
+
import { DebugView } from 'react-native-debug-toolkit';
|
|
76
|
+
import { NavigationContainer } from '@react-navigation/native';
|
|
77
|
+
|
|
78
|
+
function App() {
|
|
79
|
+
const navRef = useRef(null);
|
|
80
|
+
return (
|
|
81
|
+
<DebugView navigationRef={navRef}>
|
|
82
|
+
<NavigationContainer ref={navRef}>
|
|
83
|
+
<AppContent />
|
|
84
|
+
</NavigationContainer>
|
|
85
|
+
</DebugView>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 环境切换
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
<DebugView
|
|
94
|
+
environments={[
|
|
95
|
+
{ id: 'dev', label: 'Dev', host: 'dev-api.example.com', color: '#34C759' },
|
|
96
|
+
{ id: 'prod', label: 'Prod', host: 'api.example.com', color: '#FF3B30' },
|
|
97
|
+
]}
|
|
98
|
+
>
|
|
99
|
+
<AppContent />
|
|
100
|
+
</DebugView>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Zustand 中间件
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { zustandLogMiddleware } from 'react-native-debug-toolkit';
|
|
107
|
+
|
|
108
|
+
const useStore = create(
|
|
109
|
+
zustandLogMiddleware((set) => ({
|
|
110
|
+
count: 0,
|
|
111
|
+
increment: () => set((s) => ({ count: s.count + 1 }), false, 'increment'),
|
|
112
|
+
// ↑ merge ↑ action 名称(显示在调试面板)
|
|
113
|
+
}))
|
|
114
|
+
);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 自定义事件
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import { addTrackLog } from 'react-native-debug-toolkit';
|
|
121
|
+
|
|
122
|
+
addTrackLog({ eventName: 'button_click', buttonId: 'submit' });
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 网络黑名单 & Axios
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
import axios from 'axios';
|
|
129
|
+
|
|
130
|
+
const api = axios.create({ baseURL: 'https://api.example.com' });
|
|
131
|
+
|
|
132
|
+
<DebugView
|
|
133
|
+
features={{
|
|
134
|
+
network: {
|
|
135
|
+
maxLogs: 100,
|
|
136
|
+
blacklist: ['/analytics', /\/healthcheck$/],
|
|
137
|
+
axiosInstance: api,
|
|
138
|
+
},
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
<AppContent />
|
|
142
|
+
</DebugView>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 命令式 API
|
|
146
|
+
|
|
147
|
+
用于 React 外部的编程控制(通知、深度链接、开发专用按钮):
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import { DebugToolkit } from 'react-native-debug-toolkit';
|
|
151
|
+
|
|
152
|
+
DebugToolkit.openPanel();
|
|
153
|
+
DebugToolkit.clearAll();
|
|
154
|
+
DebugToolkit.showLauncher();
|
|
155
|
+
DebugToolkit.hideLauncher();
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
完整 API:`DebugToolkit` 是单例,提供 `openPanel`、`closePanel`、`togglePanel`、`clearAll`、`showLauncher`、`hideLauncher`、`addFeature`、`removeFeature`、`destroy`、`features`、`panelOpen`。详见 TypeScript 类型定义。
|
|
159
|
+
|
|
160
|
+
## 对等依赖
|
|
161
|
+
|
|
162
|
+
| 包 | 版本 | 必需 |
|
|
163
|
+
|----|------|------|
|
|
164
|
+
| react | >= 18.0.0 | 是 |
|
|
165
|
+
| react-native | >= 0.72.0 | 是 |
|
|
166
|
+
| @react-native-clipboard/clipboard | >= 1.0.0 | 否 |
|
|
167
|
+
| @react-native-async-storage/async-storage | >= 1.0.0 | 否 |
|
|
168
|
+
|
|
169
|
+
## 许可证
|
|
170
|
+
|
|
171
|
+
MIT
|