react-native-inapp-inspector 2.3.10 → 2.3.11

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.
Files changed (43) hide show
  1. package/dist/commonjs/components/Inspector/DebuggingTab.d.ts +3 -0
  2. package/dist/commonjs/components/Inspector/DebuggingTab.js +682 -0
  3. package/dist/commonjs/components/Inspector/MainScreen.js +2 -0
  4. package/dist/commonjs/components/Inspector/SettingsPanel.js +12 -0
  5. package/dist/commonjs/components/Inspector/TabBar.js +9 -0
  6. package/dist/commonjs/components/NetworkIcons.d.ts +1 -0
  7. package/dist/commonjs/components/NetworkIcons.js +8 -1
  8. package/dist/commonjs/components/QRCodeView.d.ts +9 -0
  9. package/dist/commonjs/components/QRCodeView.js +79 -0
  10. package/dist/commonjs/constants/version.d.ts +1 -1
  11. package/dist/commonjs/constants/version.js +1 -1
  12. package/dist/commonjs/helpers/qrGenerator.d.ts +2 -0
  13. package/dist/commonjs/helpers/qrGenerator.js +170 -0
  14. package/dist/commonjs/index.js +2 -0
  15. package/dist/commonjs/types/enums.d.ts +2 -0
  16. package/dist/commonjs/types/enums.js +2 -0
  17. package/dist/esm/components/Inspector/DebuggingTab.d.ts +3 -0
  18. package/dist/esm/components/Inspector/DebuggingTab.js +642 -0
  19. package/dist/esm/components/Inspector/MainScreen.js +2 -0
  20. package/dist/esm/components/Inspector/SettingsPanel.js +13 -1
  21. package/dist/esm/components/Inspector/TabBar.js +10 -1
  22. package/dist/esm/components/NetworkIcons.d.ts +1 -0
  23. package/dist/esm/components/NetworkIcons.js +6 -0
  24. package/dist/esm/components/QRCodeView.d.ts +9 -0
  25. package/dist/esm/components/QRCodeView.js +42 -0
  26. package/dist/esm/constants/version.d.ts +1 -1
  27. package/dist/esm/constants/version.js +1 -1
  28. package/dist/esm/helpers/qrGenerator.d.ts +2 -0
  29. package/dist/esm/helpers/qrGenerator.js +167 -0
  30. package/dist/esm/index.js +2 -0
  31. package/dist/esm/types/enums.d.ts +2 -0
  32. package/dist/esm/types/enums.js +2 -0
  33. package/package.json +1 -1
  34. package/src/components/Inspector/DebuggingTab.tsx +755 -0
  35. package/src/components/Inspector/MainScreen.tsx +2 -0
  36. package/src/components/Inspector/SettingsPanel.tsx +20 -0
  37. package/src/components/Inspector/TabBar.tsx +11 -0
  38. package/src/components/NetworkIcons.tsx +39 -0
  39. package/src/components/QRCodeView.tsx +71 -0
  40. package/src/constants/version.ts +1 -1
  41. package/src/helpers/qrGenerator.ts +184 -0
  42. package/src/index.tsx +2 -0
  43. package/src/types/enums.ts +2 -0
@@ -4,7 +4,7 @@ import { useInspector } from './InspectorContext';
4
4
  import styles from '../../styles';
5
5
  import { AppColors } from '../../styles/AppColors';
6
6
  import TouchableScale from '../TouchableScale';
7
- import { SignalIcon, TerminalIcon, AnalyticsIcon, PackageIcon, ReduxIcon, PerformanceIcon, CrashIcon, SmartphoneIcon, DatabaseIcon, } from '../NetworkIcons';
7
+ import { SignalIcon, TerminalIcon, AnalyticsIcon, PackageIcon, ReduxIcon, PerformanceIcon, CrashIcon, SmartphoneIcon, DatabaseIcon, QrCodeIcon, } from '../NetworkIcons';
8
8
  import { isReduxConnected } from '../../customHooks/reduxLogger';
9
9
  import { isAnalyticsConnected } from '../../customHooks/analyticsLogger';
10
10
  const TabBar = React.memo(() => {
@@ -68,8 +68,16 @@ const TabBar = React.memo(() => {
68
68
  count: 0,
69
69
  icon: 'storage',
70
70
  },
71
+ {
72
+ key: 'debugging',
73
+ label: 'Debugging',
74
+ count: 0,
75
+ icon: 'debugging',
76
+ },
71
77
  ]
72
78
  .filter(tab => {
79
+ if (tab.key === 'debugging')
80
+ return true;
73
81
  if (!tabVisibility?.[tab.key])
74
82
  return false;
75
83
  if (tab.key === 'redux' && !isReduxAvail)
@@ -112,6 +120,7 @@ const TabBar = React.memo(() => {
112
120
  {tab.icon === 'crash' && (<CrashIcon color={iconColor} size={14}/>)}
113
121
  {tab.icon === 'device' && (<SmartphoneIcon color={iconColor} size={14}/>)}
114
122
  {tab.icon === 'storage' && (<DatabaseIcon color={iconColor} size={14}/>)}
123
+ {tab.icon === 'debugging' && (<QrCodeIcon color={iconColor} size={14}/>)}
115
124
  <Text numberOfLines={1} ellipsizeMode="tail" style={[
116
125
  styles.contentTabButtonText,
117
126
  isActive &&
@@ -134,3 +134,4 @@ export declare const DatabaseIcon: ({ color, size, }: IconProps) => React.JSX.El
134
134
  export declare const PencilIcon: ({ color, size, }: IconProps) => React.JSX.Element;
135
135
  export declare const PlusIcon: ({ color, size, }: IconProps) => React.JSX.Element;
136
136
  export declare const LockIcon: ({ color, size, }: IconProps) => React.JSX.Element;
137
+ export declare const QrCodeIcon: ({ color, size, }: IconProps) => React.JSX.Element;
@@ -734,3 +734,9 @@ export const LockIcon = ({ color = AppColors.grayTextWeak, size = 14, }) => (<Sv
734
734
  <Rect x="3" y="11" width="18" height="11" rx="2" ry="2" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
735
735
  <Path d="M7 11V7a5 5 0 0 1 10 0v4" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
736
736
  </Svg>);
737
+ export const QrCodeIcon = ({ color = AppColors.grayTextWeak, size = 14, }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
738
+ <Rect x="3" y="3" width="7" height="7" rx="1.5" stroke={color} strokeWidth="2"/>
739
+ <Rect x="14" y="3" width="7" height="7" rx="1.5" stroke={color} strokeWidth="2"/>
740
+ <Rect x="3" y="14" width="7" height="7" rx="1.5" stroke={color} strokeWidth="2"/>
741
+ <Path d="M14 14h3v3h-3zM18 18h3v3h-3zM14 19h3v2h-3zM19 14h2v3h-2z" fill={color}/>
742
+ </Svg>);
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface QRCodeViewProps {
3
+ value: string;
4
+ size?: number;
5
+ color?: string;
6
+ backgroundColor?: string;
7
+ }
8
+ export declare const QRCodeView: React.FC<QRCodeViewProps>;
9
+ export default QRCodeView;
@@ -0,0 +1,42 @@
1
+ import React, { useMemo } from 'react';
2
+ import { View, StyleSheet } from 'react-native';
3
+ import Svg, { Rect, G } from 'react-native-svg';
4
+ import { generateQRMatrix } from '../helpers/qrGenerator';
5
+ import { AppColors } from '../styles/AppColors';
6
+ export const QRCodeView = ({ value, size = 180, color = AppColors.primaryBlack, backgroundColor = AppColors.white, }) => {
7
+ const matrix = useMemo(() => generateQRMatrix(value), [value]);
8
+ const numCells = matrix.length;
9
+ const cellSize = size / numCells;
10
+ return (<View style={[
11
+ styles.container,
12
+ {
13
+ width: size + 16,
14
+ height: size + 16,
15
+ backgroundColor,
16
+ },
17
+ ]}>
18
+ <Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>
19
+ <G>
20
+ {matrix.map((row, r) => row.map((cell, c) => {
21
+ if (!cell)
22
+ return null;
23
+ return (<Rect key={`${r}-${c}`} x={c * cellSize} y={r * cellSize} width={cellSize + 0.2} height={cellSize + 0.2} fill={color}/>);
24
+ }))}
25
+ </G>
26
+ </Svg>
27
+ </View>);
28
+ };
29
+ const styles = StyleSheet.create({
30
+ container: {
31
+ padding: 8,
32
+ borderRadius: 14,
33
+ alignItems: 'center',
34
+ justifyContent: 'center',
35
+ shadowColor: AppColors.black,
36
+ shadowOffset: { width: 0, height: 2 },
37
+ shadowOpacity: 0.1,
38
+ shadowRadius: 6,
39
+ elevation: 3,
40
+ },
41
+ });
42
+ export default QRCodeView;
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "2.3.10";
1
+ export declare const LIB_VERSION = "2.3.11";
@@ -1 +1 @@
1
- export const LIB_VERSION = '2.3.10';
1
+ export const LIB_VERSION = '2.3.11';
@@ -0,0 +1,2 @@
1
+ export type QRECC = 'L' | 'M' | 'Q' | 'H';
2
+ export declare function generateQRMatrix(text: string, ecc?: QRECC): boolean[][];
@@ -0,0 +1,167 @@
1
+ export function generateQRMatrix(text, ecc = 'M') {
2
+ try {
3
+ return createQRMatrix(text, ecc);
4
+ }
5
+ catch {
6
+ return createFallbackMatrix(text);
7
+ }
8
+ }
9
+ function createQRMatrix(data, ecc) {
10
+ const length = data.length;
11
+ let version = 1;
12
+ if (length > 14)
13
+ version = 2;
14
+ if (length > 26)
15
+ version = 3;
16
+ if (length > 42)
17
+ version = 4;
18
+ if (length > 62)
19
+ version = 5;
20
+ if (length > 84)
21
+ version = 6;
22
+ if (length > 106)
23
+ version = 7;
24
+ if (length > 122)
25
+ version = 8;
26
+ if (length > 152)
27
+ version = 9;
28
+ if (length > 180)
29
+ version = 10;
30
+ const size = version * 4 + 17;
31
+ const matrix = Array(size)
32
+ .fill(null)
33
+ .map(() => Array(size).fill(null));
34
+ addFinderPattern(matrix, 0, 0);
35
+ addFinderPattern(matrix, size - 7, 0);
36
+ addFinderPattern(matrix, 0, size - 7);
37
+ for (let i = 8; i < size - 8; i++) {
38
+ const val = i % 2 === 0;
39
+ if (matrix[6][i] === null)
40
+ matrix[6][i] = val;
41
+ if (matrix[i][6] === null)
42
+ matrix[i][6] = val;
43
+ }
44
+ if (version >= 2) {
45
+ const pos = getAlignmentPositions(version);
46
+ for (const r of pos) {
47
+ for (const c of pos) {
48
+ if (matrix[r][c] === null) {
49
+ addAlignmentPattern(matrix, r - 2, c - 2);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ const bits = [];
55
+ bits.push(false, true, false, false);
56
+ for (let i = 7; i >= 0; i--) {
57
+ bits.push(((length >> i) & 1) === 1);
58
+ }
59
+ for (let i = 0; i < length; i++) {
60
+ const code = data.charCodeAt(i);
61
+ for (let b = 7; b >= 0; b--) {
62
+ bits.push(((code >> b) & 1) === 1);
63
+ }
64
+ }
65
+ for (let i = 0; i < 4 && bits.length % 8 !== 0; i++) {
66
+ bits.push(false);
67
+ }
68
+ while (bits.length % 8 !== 0) {
69
+ bits.push(false);
70
+ }
71
+ const padBytes = [0xec, 0x11];
72
+ let padIdx = 0;
73
+ const totalDataBits = size * size * 0.6;
74
+ while (bits.length < totalDataBits) {
75
+ const b = padBytes[padIdx % 2];
76
+ padIdx++;
77
+ for (let bit = 7; bit >= 0; bit--) {
78
+ bits.push(((b >> bit) & 1) === 1);
79
+ }
80
+ }
81
+ let bitIdx = 0;
82
+ let upwards = true;
83
+ for (let col = size - 1; col > 0; col -= 2) {
84
+ if (col === 6)
85
+ col--;
86
+ const rows = upwards
87
+ ? Array.from({ length: size }, (_, i) => size - 1 - i)
88
+ : Array.from({ length: size }, (_, i) => i);
89
+ for (const row of rows) {
90
+ for (const c of [col, col - 1]) {
91
+ if (matrix[row][c] === null) {
92
+ const bit = bitIdx < bits.length ? bits[bitIdx++] : false;
93
+ const mask = (row + c) % 2 === 0;
94
+ matrix[row][c] = bit !== mask;
95
+ }
96
+ }
97
+ }
98
+ upwards = !upwards;
99
+ }
100
+ return matrix.map(row => row.map(cell => cell ?? false));
101
+ }
102
+ function addFinderPattern(matrix, row, col) {
103
+ for (let r = -1; r <= 7; r++) {
104
+ for (let c = -1; c <= 7; c++) {
105
+ const mr = row + r;
106
+ const mc = col + c;
107
+ if (mr >= 0 && mr < matrix.length && mc >= 0 && mc < matrix.length) {
108
+ if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||
109
+ (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||
110
+ (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {
111
+ matrix[mr][mc] = true;
112
+ }
113
+ else if (r >= 0 && r <= 6 && c >= 0 && c <= 6) {
114
+ matrix[mr][mc] = false;
115
+ }
116
+ else {
117
+ matrix[mr][mc] = false;
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ function addAlignmentPattern(matrix, row, col) {
124
+ for (let r = 0; r < 5; r++) {
125
+ for (let c = 0; c < 5; c++) {
126
+ const isOuter = r === 0 || r === 4 || c === 0 || c === 4;
127
+ const isCenter = r === 2 && c === 2;
128
+ matrix[row + r][col + c] = isOuter || isCenter;
129
+ }
130
+ }
131
+ }
132
+ function getAlignmentPositions(version) {
133
+ if (version === 1)
134
+ return [];
135
+ if (version === 2)
136
+ return [6, 18];
137
+ if (version === 3)
138
+ return [6, 22];
139
+ if (version === 4)
140
+ return [6, 26];
141
+ if (version === 5)
142
+ return [6, 30];
143
+ if (version === 6)
144
+ return [6, 34];
145
+ if (version === 7)
146
+ return [6, 22, 38];
147
+ if (version === 8)
148
+ return [6, 24, 42];
149
+ if (version === 9)
150
+ return [6, 26, 46];
151
+ return [6, 28, 50];
152
+ }
153
+ function createFallbackMatrix(text) {
154
+ const size = 25;
155
+ const matrix = Array(size)
156
+ .fill(false)
157
+ .map(() => Array(size).fill(false));
158
+ addFinderPattern(matrix, 0, 0);
159
+ addFinderPattern(matrix, size - 7, 0);
160
+ addFinderPattern(matrix, 0, size - 7);
161
+ for (let i = 0; i < text.length; i++) {
162
+ const r = (i * 3) % (size - 10) + 8;
163
+ const c = (i * 7) % (size - 10) + 8;
164
+ matrix[r][c] = true;
165
+ }
166
+ return matrix;
167
+ }
package/dist/esm/index.js CHANGED
@@ -168,6 +168,7 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
168
168
  crash: false,
169
169
  device: false,
170
170
  storage: false,
171
+ debugging: true,
171
172
  });
172
173
  const [maxNetworkLogs, setMaxNetworkLogs] = useState(100);
173
174
  const [maxAnalyticsEventsLimit, setMaxAnalyticsEventsLimit] = useState(75);
@@ -221,6 +222,7 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
221
222
  crash: false,
222
223
  device: false,
223
224
  storage: false,
225
+ debugging: true,
224
226
  });
225
227
  setDefaultTab('apis');
226
228
  setIsAutoRamLimitEnabled(true);
@@ -8,6 +8,7 @@ export declare const ActiveTab: {
8
8
  readonly Crash: "crash";
9
9
  readonly Device: "device";
10
10
  readonly Storage: "storage";
11
+ readonly Debugging: "debugging";
11
12
  };
12
13
  export type ActiveTab = (typeof ActiveTab)[keyof typeof ActiveTab];
13
14
  export declare const Method: {
@@ -59,6 +60,7 @@ export declare const SettingsPage: {
59
60
  readonly Crash: "crash";
60
61
  readonly Device: "device";
61
62
  readonly Storage: "storage";
63
+ readonly Debugging: "debugging";
62
64
  };
63
65
  export type SettingsPage = (typeof SettingsPage)[keyof typeof SettingsPage] | null;
64
66
  export declare const SettingsSubTab: {
@@ -8,6 +8,7 @@ export const ActiveTab = {
8
8
  Crash: 'crash',
9
9
  Device: 'device',
10
10
  Storage: 'storage',
11
+ Debugging: 'debugging',
11
12
  };
12
13
  export const Method = {
13
14
  All: 'ALL',
@@ -53,6 +54,7 @@ export const SettingsPage = {
53
54
  Crash: 'crash',
54
55
  Device: 'device',
55
56
  Storage: 'storage',
57
+ Debugging: 'debugging',
56
58
  };
57
59
  export const SettingsSubTab = {
58
60
  Module: 'module',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-inapp-inspector",
3
- "version": "2.3.10",
3
+ "version": "2.3.11",
4
4
  "description": "The zero-config, all-in-one in-app debugger for React Native & Expo. Inspect Network (fetch/axios), Console logs, Stack Traces, Redux State, Firebase Analytics, and JS Bundle size directly on device.",
5
5
  "repository": {
6
6
  "type": "git",