react-native-debug-toolkit 0.5.1 → 0.5.3

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/index.js CHANGED
@@ -12,6 +12,14 @@ import { createZustandLogFeature, addZustandLog } from './lib/features/ZustandLo
12
12
  import { createNavigationLogFeature, addNavigationLog } from './lib/features/NavigationLogFeature'
13
13
  import { useNavigationLogger } from './lib/hooks/useNavigationLogger'
14
14
 
15
+ // Function to clear all logs and close the panel
16
+ const clearAll = () => {
17
+ const instance = DebugToolKit.instance;
18
+ if (instance && typeof instance.clearAll === 'function') {
19
+ instance.clearAll();
20
+ }
21
+ };
22
+
15
23
  export {
16
24
  DebugToolKit,
17
25
  initializeDebugToolkit,
@@ -23,7 +31,8 @@ export {
23
31
  createNavigationLogFeature,
24
32
  addNavigationLog,
25
33
  useNavigationLogger,
26
- isDebugMode
34
+ isDebugMode,
35
+ clearAll
27
36
  }
28
37
 
29
38
  export default DebugToolKit
@@ -13,7 +13,9 @@ export default class DebugToolKit {
13
13
  }
14
14
 
15
15
  // Set the debug mode flag directly from NativeDebugLibs
16
- this.isDebugMode = NativeDebugLibs.isDebugBuild()
16
+ // this.isDebugMode = NativeDebugLibs.isDebugBuild()
17
+ this.isDebugMode = true
18
+
17
19
  this.floatPanel = null
18
20
  this.features = []
19
21
  this.isPanelVisible = false
@@ -53,6 +55,21 @@ export default class DebugToolKit {
53
55
  return this
54
56
  }
55
57
 
58
+
59
+ clearAll = () => {
60
+ // Clear all logs from all features
61
+ this.features.forEach((feature) => {
62
+ if (typeof feature.cleanup === 'function') {
63
+ feature.cleanup();
64
+ }
65
+ // Re-setup the feature to initialize it again
66
+ if (typeof feature.setup === 'function') {
67
+ feature.setup();
68
+ }
69
+ });
70
+
71
+ }
72
+
56
73
  showDebugPanel = () => {
57
74
  if (!this.isDebugMode) {
58
75
  return
@@ -60,7 +77,11 @@ export default class DebugToolKit {
60
77
 
61
78
  if (!this.floatPanel) {
62
79
  this.floatPanel = new RootSiblings(
63
- <FloatPanelView features={this.features} close={this.hideDebugPanel} />,
80
+ <FloatPanelView
81
+ features={this.features}
82
+ close={this.hideDebugPanel}
83
+ clearAll={this.clearAll}
84
+ />,
64
85
  )
65
86
  }
66
87
  this.isPanelVisible = true
@@ -76,7 +97,11 @@ export default class DebugToolKit {
76
97
  updateDebugPanel() {
77
98
  if (this.floatPanel) {
78
99
  this.floatPanel.update(
79
- <FloatPanelView features={this.features} close={this.hideDebugPanel} />,
100
+ <FloatPanelView
101
+ features={this.features}
102
+ close={this.hideDebugPanel}
103
+ clearAll={this.clearAll}
104
+ />,
80
105
  )
81
106
  }
82
107
  }
package/lib/index.js CHANGED
@@ -23,7 +23,8 @@ const featureRegistry = {
23
23
  const defaultFeatures = ['network', 'console', 'zustand', 'navigation', 'thirdPartyLibs']
24
24
 
25
25
  // Export the debug mode status - this is used by the app
26
- const isDebugMode = NativeDebugLibs.isDebugBuild();
26
+ // const isDebugMode = NativeDebugLibs.isDebugBuild();
27
+ const isDebugMode = true
27
28
 
28
29
  /**
29
30
  * Initializes and shows the Debug ToolKit panel with specified features.
@@ -387,6 +387,8 @@ export default class FloatPanelView extends Component {
387
387
 
388
388
  renderPanel() {
389
389
  const { isOpen, panelTranslateY, backdropOpacity } = this.state
390
+ const { clearAll } = this.props
391
+
390
392
 
391
393
  if (!isOpen) {
392
394
  return null
@@ -414,10 +416,23 @@ export default class FloatPanelView extends Component {
414
416
  </View>
415
417
  <SafeAreaView style={styles.panelContent}>
416
418
  <View style={styles.header}>
417
- <Text style={styles.headerTitle}>Debug Panel</Text>
418
- <Pressable onPress={this._closePanel} style={styles.closeButton}>
419
- <Text style={styles.closeButtonText}>×</Text>
420
- </Pressable>
419
+ <Text style={styles.headerTitle}>Debug Toolkit</Text>
420
+ <View style={styles.headerButtons}>
421
+ {clearAll && (
422
+ <TouchableOpacity
423
+ onPress={() => {
424
+ clearAll()
425
+ this._closePanel()
426
+ }}
427
+ style={[styles.clearButton, styles.clearAllButton]}
428
+ >
429
+ <Text style={styles.clearButtonText}>Clear & Close</Text>
430
+ </TouchableOpacity>
431
+ )}
432
+ <Pressable onPress={this._closePanel} style={styles.closeButton}>
433
+ <Text style={styles.closeButtonText}>×</Text>
434
+ </Pressable>
435
+ </View>
421
436
  </View>
422
437
 
423
438
  {this.renderTabBar()}
@@ -531,23 +546,77 @@ const styles = StyleSheet.create({
531
546
  flexDirection: 'row',
532
547
  justifyContent: 'space-between',
533
548
  alignItems: 'center',
534
- paddingHorizontal: 20,
535
- paddingBottom: 4,
549
+ paddingHorizontal: 15,
550
+ paddingVertical: 12,
536
551
  borderBottomWidth: 1,
537
- borderBottomColor: DebugColors.border,
552
+ borderBottomColor: '#e5e5e5',
553
+ backgroundColor: '#f9f9f9',
554
+ shadowColor: "#000",
555
+ shadowOffset: {
556
+ width: 0,
557
+ height: 1,
558
+ },
559
+ shadowOpacity: 0.1,
560
+ shadowRadius: 1.5,
561
+ elevation: 1,
538
562
  },
539
563
  headerTitle: {
540
564
  fontSize: 18,
541
- fontWeight: 'bold',
542
- color: DebugColors.text,
565
+ fontWeight: '700',
566
+ color: '#2c3e50',
567
+ },
568
+ headerButtons: {
569
+ flexDirection: 'row',
570
+ alignItems: 'center',
571
+ },
572
+ clearButton: {
573
+ backgroundColor: DebugColors.blue,
574
+ paddingHorizontal: 10,
575
+ paddingVertical: 5,
576
+ borderRadius: 4,
577
+ marginRight: 10,
578
+ },
579
+ clearAllButton: {
580
+ backgroundColor: '#3498db',
581
+ paddingHorizontal: 14,
582
+ paddingVertical: 9,
583
+ borderRadius: 6,
584
+ marginRight: 12,
585
+ shadowColor: "#000",
586
+ shadowOffset: {
587
+ width: 0,
588
+ height: 1,
589
+ },
590
+ shadowOpacity: 0.12,
591
+ shadowRadius: 1,
592
+ elevation: 2,
593
+ },
594
+ clearButtonText: {
595
+ color: '#fff',
596
+ fontSize: 13,
597
+ fontWeight: '600',
543
598
  },
544
599
  closeButton: {
545
- padding: 8,
600
+ width: 30,
601
+ height: 30,
602
+ borderRadius: 15,
603
+ backgroundColor: '#ecf0f1',
604
+ alignItems: 'center',
605
+ justifyContent: 'center',
606
+ shadowColor: "#000",
607
+ shadowOffset: {
608
+ width: 0,
609
+ height: 1,
610
+ },
611
+ shadowOpacity: 0.1,
612
+ shadowRadius: 1,
613
+ elevation: 1,
546
614
  },
547
615
  closeButtonText: {
548
- fontSize: 24,
549
- color: DebugColors.text,
616
+ fontSize: 20,
550
617
  fontWeight: 'bold',
618
+ color: '#34495e',
619
+ lineHeight: 20,
551
620
  },
552
621
  tabBarContainer: {
553
622
  borderBottomWidth: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-debug-toolkit",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "A simple yet powerful debugging toolkit for React Native with a convenient floating UI for development",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",