react-native-inapp-inspector 1.1.8 → 1.1.9
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 +42 -3
- package/dist/commonjs/components/LogCard.js +14 -1
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/helpers/index.d.ts +1 -0
- package/dist/commonjs/helpers/index.js +12 -1
- package/dist/commonjs/index.js +31 -1
- package/dist/commonjs/styles/index.d.ts +3 -0
- package/dist/commonjs/styles/index.js +9 -6
- package/dist/esm/components/LogCard.js +15 -2
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.js +10 -0
- package/dist/esm/index.js +31 -1
- package/dist/esm/styles/index.d.ts +3 -0
- package/dist/esm/styles/index.js +9 -6
- package/example/App.tsx +4 -3
- package/example/package-lock.json +4 -4
- package/example/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,6 +125,32 @@ If no `storage` prop is passed, Android will fall back to an in-memory store (se
|
|
|
125
125
|
|
|
126
126
|
---
|
|
127
127
|
|
|
128
|
+
## Navigation & Screen Tracking
|
|
129
|
+
|
|
130
|
+
To group network requests, console logs, and analytics events by the specific navigation screen where they occurred, the inspector automatically hooks into React Navigation context.
|
|
131
|
+
|
|
132
|
+
If you mount `<NetworkInspector />` globally at the root of your application (outside of the `<NavigationContainer>`), it won't have access to React Navigation's context. To enable accurate screen tracking in this setup, create a navigation ref and pass it to the `navigationRef` prop:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import { NavigationContainer, createNavigationContainerRef } from '@react-navigation/native';
|
|
136
|
+
import NetworkInspector from 'react-native-inapp-inspector';
|
|
137
|
+
|
|
138
|
+
const navigationRef = createNavigationContainerRef();
|
|
139
|
+
|
|
140
|
+
const App = () => {
|
|
141
|
+
return (
|
|
142
|
+
<>
|
|
143
|
+
<NavigationContainer ref={navigationRef}>
|
|
144
|
+
{/* Navigators / Screens */}
|
|
145
|
+
</NavigationContainer>
|
|
146
|
+
<NetworkInspector navigationRef={navigationRef} />
|
|
147
|
+
</>
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
128
154
|
## Network Logging
|
|
129
155
|
|
|
130
156
|
`setupNetworkLogger()` patches global `fetch`, the default axios instance, and future axios instances created with `axios.create()`.
|
|
@@ -272,8 +298,11 @@ import {ErrorBoundary} from 'react-native-inapp-inspector';
|
|
|
272
298
|
| `clearAnalyticsEvents()` | function | Clears captured analytics events. |
|
|
273
299
|
| `subscribeAnalyticsEvents(callback)` | function | Subscribes to analytics event updates and returns an unsubscribe function. |
|
|
274
300
|
| `connectReduxStore(store)` | function | Connects a Redux store for live state and action inspection. |
|
|
301
|
+
| `inspectorReduxMiddleware` | middleware | Redux middleware to capture actions dispatched from thunks/sagas. |
|
|
275
302
|
| `getReduxState()` | function | Returns the latest captured Redux state. |
|
|
276
303
|
| `subscribeReduxState(callback)` | function | Subscribes to Redux state updates and returns an unsubscribe function. |
|
|
304
|
+
| `getActionHistory()` | function | Returns the recent dispatched Redux actions. |
|
|
305
|
+
| `clearActionHistory()` | function | Clears the Redux action history. |
|
|
277
306
|
| `WebView` | component | Instrumented WebView wrapper. |
|
|
278
307
|
| `getWebViewLogs()` | function | Returns captured WebView console logs. |
|
|
279
308
|
| `getWebViewNavHistory()` | function | Returns captured WebView navigation history. |
|
|
@@ -300,11 +329,21 @@ npm run ios
|
|
|
300
329
|
|
|
301
330
|
---
|
|
302
331
|
|
|
303
|
-
##
|
|
332
|
+
## Contributing 🤝
|
|
333
|
+
|
|
334
|
+
Contributions are welcome! Please check out our [Contributing Guidelines](CONTRIBUTING.md) to learn how to get started, set up the development environment, or request features.
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Support & Sponsoring 💖
|
|
339
|
+
|
|
340
|
+
This library is a completely free, open-source utility maintained in the author's spare time. If this tool has saved you or your team hours of debugging, please consider supporting its continuous development.
|
|
341
|
+
|
|
342
|
+
Sponsoring helps prioritize your bug fixes, maintain compatibility with new React Native versions, and support new features.
|
|
304
343
|
|
|
305
|
-
|
|
344
|
+
👉 **[Sponsor @vengatmacuser on GitHub Sponsors](https://github.com/sponsors/vengatmacuser)**
|
|
306
345
|
|
|
307
|
-
[](https://github.com/sponsors/vengatmacuser)
|
|
346
|
+
[](https://github.com/sponsors/vengatmacuser)
|
|
308
347
|
|
|
309
348
|
---
|
|
310
349
|
|
|
@@ -43,6 +43,7 @@ const AppColors_1 = require("../styles/AppColors");
|
|
|
43
43
|
const constants_1 = require("../constants");
|
|
44
44
|
const helpers_1 = require("../helpers");
|
|
45
45
|
const NetworkIcons_1 = require("./NetworkIcons");
|
|
46
|
+
const AppFonts_1 = require("../styles/AppFonts");
|
|
46
47
|
const styles_1 = __importDefault(require("../styles"));
|
|
47
48
|
const HighlightText_1 = __importDefault(require("./HighlightText"));
|
|
48
49
|
const TouchableScale_1 = __importDefault(require("./TouchableScale"));
|
|
@@ -74,6 +75,8 @@ const LogCard = react_1.default.memo(function LogCard({ item, onPress, timelineM
|
|
|
74
75
|
}
|
|
75
76
|
}, [isNew]);
|
|
76
77
|
const path = (0, helpers_1.getPath)(item.url);
|
|
78
|
+
const baseUrl = (0, helpers_1.getBaseUrl)(item.url) || item.url;
|
|
79
|
+
const showPathRow = baseUrl !== item.url && path !== '/';
|
|
77
80
|
const triggeredAt = (0, helpers_1.formatDateTime)(item.startTime);
|
|
78
81
|
const isJson = item.url.split('?')[0].toLowerCase().endsWith('.json');
|
|
79
82
|
return (<TouchableScale_1.default onPress={onPress} style={[
|
|
@@ -102,7 +105,7 @@ const LogCard = react_1.default.memo(function LogCard({ item, onPress, timelineM
|
|
|
102
105
|
</react_native_1.Text>
|
|
103
106
|
</react_native_1.View>
|
|
104
107
|
|
|
105
|
-
<HighlightText_1.default text={
|
|
108
|
+
<HighlightText_1.default text={baseUrl} search={searchStr} style={styles_1.default.urlPathText} highlightStyle={styles_1.default.highlight} numberOfLines={0}/>
|
|
106
109
|
|
|
107
110
|
{isJson && (<react_native_1.View style={[
|
|
108
111
|
styles_1.default.chip,
|
|
@@ -135,6 +138,16 @@ const LogCard = react_1.default.memo(function LogCard({ item, onPress, timelineM
|
|
|
135
138
|
</react_native_1.View>)}
|
|
136
139
|
</react_native_1.View>
|
|
137
140
|
|
|
141
|
+
{showPathRow && (<react_native_1.View style={{ flexDirection: 'row', alignItems: 'flex-start', marginTop: 3, marginBottom: 5, paddingLeft: 30, gap: 6 }}>
|
|
142
|
+
<react_native_1.Text style={{ color: AppColors_1.AppColors.grayTextWeak, fontSize: 9, fontFamily: AppFonts_1.AppFonts.interBold, letterSpacing: 0.5, marginTop: 2.5 }}>PATH</react_native_1.Text>
|
|
143
|
+
<HighlightText_1.default text={path} search={searchStr} style={{
|
|
144
|
+
fontFamily: AppFonts_1.AppFonts.Sfprotext || 'System',
|
|
145
|
+
fontSize: 12,
|
|
146
|
+
color: AppColors_1.AppColors.grayText,
|
|
147
|
+
flex: 1,
|
|
148
|
+
}} highlightStyle={styles_1.default.highlight} numberOfLines={0}/>
|
|
149
|
+
</react_native_1.View>)}
|
|
150
|
+
|
|
138
151
|
<react_native_1.View style={styles_1.default.cardBottomRow}>
|
|
139
152
|
<react_native_1.View style={styles_1.default.cardDateRow}>
|
|
140
153
|
<NetworkIcons_1.CalendarIcon color={AppColors_1.AppColors.grayTextWeak} size={11}/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "1.1.
|
|
1
|
+
export declare const LIB_VERSION = "1.1.9";
|
|
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LIB_VERSION = void 0;
|
|
4
4
|
// AUTO-GENERATED FILE — do not edit by hand.
|
|
5
5
|
// Regenerated from package.json on every build by scripts/gen-version.js.
|
|
6
|
-
exports.LIB_VERSION = '1.1.
|
|
6
|
+
exports.LIB_VERSION = '1.1.9';
|
|
@@ -6,6 +6,7 @@ export declare const getDurationColor: (duration: number | null) => string;
|
|
|
6
6
|
export declare const getSize: (data: unknown) => string;
|
|
7
7
|
export declare const copyToClipboard: (value: unknown, label: string) => void;
|
|
8
8
|
export declare const getPath: (url: string) => string;
|
|
9
|
+
export declare const getBaseUrl: (url: string) => string;
|
|
9
10
|
export declare const getCurlCommand: (log: NetworkLog) => string;
|
|
10
11
|
export declare const getFetchCommand: (log: NetworkLog) => string;
|
|
11
12
|
export declare const deduplicateLogs: (raw: NetworkLog[]) => NetworkLog[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatDateTimeToAnalytics = exports.isAllValuesEmpty = exports.getLocalizedFilePathWithSlash = exports.getLocalizedFilePath = exports.formatDisplayUrl = exports.getDiff = exports.flattenObject = exports.getNavigationInfo = exports.escapeRegex = exports.deduplicateLogs = exports.getFetchCommand = exports.getCurlCommand = exports.getPath = exports.copyToClipboard = exports.getSize = exports.getDurationColor = exports.getStatusColor = exports.formatDateTime = exports.getDomainColor = void 0;
|
|
3
|
+
exports.formatDateTimeToAnalytics = exports.isAllValuesEmpty = exports.getLocalizedFilePathWithSlash = exports.getLocalizedFilePath = exports.formatDisplayUrl = exports.getDiff = exports.flattenObject = exports.getNavigationInfo = exports.escapeRegex = exports.deduplicateLogs = exports.getFetchCommand = exports.getCurlCommand = exports.getBaseUrl = exports.getPath = exports.copyToClipboard = exports.getSize = exports.getDurationColor = exports.getStatusColor = exports.formatDateTime = exports.getDomainColor = void 0;
|
|
4
4
|
const react_native_1 = require("react-native");
|
|
5
5
|
// Stylesheet
|
|
6
6
|
const AppColors_1 = require("../styles/AppColors");
|
|
@@ -83,6 +83,17 @@ const getPath = (url) => {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
exports.getPath = getPath;
|
|
86
|
+
const getBaseUrl = (url) => {
|
|
87
|
+
try {
|
|
88
|
+
const u = new URL(url);
|
|
89
|
+
return `${u.protocol}//${u.host}`;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
const match = url.match(/^(https?:\/\/[^/]+)/);
|
|
93
|
+
return match ? match[1] : '';
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.getBaseUrl = getBaseUrl;
|
|
86
97
|
const getCurlCommand = (log) => {
|
|
87
98
|
let cmd = `curl -X ${log.method} "${log.url}"`;
|
|
88
99
|
if (log.requestHeaders) {
|
package/dist/commonjs/index.js
CHANGED
|
@@ -152,7 +152,7 @@ const NavigationTracker = ({ onStateChange }) => {
|
|
|
152
152
|
const animateNextLayout = () => {
|
|
153
153
|
react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut);
|
|
154
154
|
};
|
|
155
|
-
const NetworkInspector = ({ enabled = true, storage, }) => {
|
|
155
|
+
const NetworkInspector = ({ enabled = true, storage, navigationRef, }) => {
|
|
156
156
|
// Set custom storage synchronously during render phase
|
|
157
157
|
(0, settingsStore_1.setCustomStorage)(storage || null);
|
|
158
158
|
const [isDark, setIsDark] = (0, react_1.useState)(false);
|
|
@@ -545,6 +545,36 @@ const NetworkInspector = ({ enabled = true, storage, }) => {
|
|
|
545
545
|
currentRouteRef.current = (0, helpers_1.getNavigationInfo)(navState);
|
|
546
546
|
}
|
|
547
547
|
}, [navState]);
|
|
548
|
+
(0, react_1.useEffect)(() => {
|
|
549
|
+
if (!navigationRef)
|
|
550
|
+
return;
|
|
551
|
+
const updateState = () => {
|
|
552
|
+
try {
|
|
553
|
+
if (typeof navigationRef.isReady === 'function' && navigationRef.isReady()) {
|
|
554
|
+
const state = navigationRef.getRootState();
|
|
555
|
+
if (state) {
|
|
556
|
+
setNavState(state);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
catch (err) {
|
|
561
|
+
// Safe check
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
// Initialize state
|
|
565
|
+
updateState();
|
|
566
|
+
// Listen to changes
|
|
567
|
+
const unsubscribe = typeof navigationRef.addListener === 'function'
|
|
568
|
+
? navigationRef.addListener('state', () => {
|
|
569
|
+
updateState();
|
|
570
|
+
})
|
|
571
|
+
: null;
|
|
572
|
+
return () => {
|
|
573
|
+
if (unsubscribe) {
|
|
574
|
+
unsubscribe();
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
}, [navigationRef]);
|
|
548
578
|
const logRouteMapRef = (0, react_1.useRef)(new Map());
|
|
549
579
|
const prevLogIdsRef = (0, react_1.useRef)(new Set());
|
|
550
580
|
const [newLogIds, setNewLogIds] = (0, react_1.useState)(new Set());
|
|
@@ -724,6 +724,9 @@ export declare const getRawStyles: (colors: typeof AppColors) => {
|
|
|
724
724
|
paddingVertical: number;
|
|
725
725
|
borderRadius: number;
|
|
726
726
|
marginRight: number;
|
|
727
|
+
minWidth: number;
|
|
728
|
+
alignItems: string;
|
|
729
|
+
justifyContent: string;
|
|
727
730
|
shadowColor: string;
|
|
728
731
|
shadowOffset: {
|
|
729
732
|
width: number;
|
|
@@ -689,10 +689,13 @@ const getRawStyles = (colors) => ({
|
|
|
689
689
|
fontSize: 10,
|
|
690
690
|
},
|
|
691
691
|
methodBadge: {
|
|
692
|
-
paddingHorizontal:
|
|
693
|
-
paddingVertical:
|
|
694
|
-
borderRadius:
|
|
695
|
-
marginRight:
|
|
692
|
+
paddingHorizontal: 6,
|
|
693
|
+
paddingVertical: 3,
|
|
694
|
+
borderRadius: 6,
|
|
695
|
+
marginRight: 6,
|
|
696
|
+
minWidth: 46,
|
|
697
|
+
alignItems: 'center',
|
|
698
|
+
justifyContent: 'center',
|
|
696
699
|
shadowColor: '#000000',
|
|
697
700
|
shadowOffset: { width: 0, height: 1 },
|
|
698
701
|
shadowOpacity: 0.08,
|
|
@@ -701,8 +704,8 @@ const getRawStyles = (colors) => ({
|
|
|
701
704
|
},
|
|
702
705
|
methodBadgeText: {
|
|
703
706
|
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
704
|
-
fontSize:
|
|
705
|
-
letterSpacing: 0.
|
|
707
|
+
fontSize: 9.5,
|
|
708
|
+
letterSpacing: 0.4,
|
|
706
709
|
},
|
|
707
710
|
timelineTrack: {
|
|
708
711
|
height: 3,
|
|
@@ -3,8 +3,9 @@ import { Animated, View, Pressable, Text, StyleSheet } from 'react-native';
|
|
|
3
3
|
import Svg, { Path } from 'react-native-svg';
|
|
4
4
|
import { AppColors } from '../styles/AppColors';
|
|
5
5
|
import { METHOD_COLORS } from '../constants';
|
|
6
|
-
import { getStatusColor, getDurationColor, getPath, formatDateTime, } from '../helpers';
|
|
6
|
+
import { getStatusColor, getDurationColor, getPath, getBaseUrl, formatDateTime, } from '../helpers';
|
|
7
7
|
import { CalendarIcon, ClockIcon } from './NetworkIcons';
|
|
8
|
+
import { AppFonts } from '../styles/AppFonts';
|
|
8
9
|
import styles from '../styles';
|
|
9
10
|
import HighlightText from './HighlightText';
|
|
10
11
|
import TouchableScale from './TouchableScale';
|
|
@@ -36,6 +37,8 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
36
37
|
}
|
|
37
38
|
}, [isNew]);
|
|
38
39
|
const path = getPath(item.url);
|
|
40
|
+
const baseUrl = getBaseUrl(item.url) || item.url;
|
|
41
|
+
const showPathRow = baseUrl !== item.url && path !== '/';
|
|
39
42
|
const triggeredAt = formatDateTime(item.startTime);
|
|
40
43
|
const isJson = item.url.split('?')[0].toLowerCase().endsWith('.json');
|
|
41
44
|
return (<TouchableScale onPress={onPress} style={[
|
|
@@ -64,7 +67,7 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
64
67
|
</Text>
|
|
65
68
|
</View>
|
|
66
69
|
|
|
67
|
-
<HighlightText text={
|
|
70
|
+
<HighlightText text={baseUrl} search={searchStr} style={styles.urlPathText} highlightStyle={styles.highlight} numberOfLines={0}/>
|
|
68
71
|
|
|
69
72
|
{isJson && (<View style={[
|
|
70
73
|
styles.chip,
|
|
@@ -97,6 +100,16 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
97
100
|
</View>)}
|
|
98
101
|
</View>
|
|
99
102
|
|
|
103
|
+
{showPathRow && (<View style={{ flexDirection: 'row', alignItems: 'flex-start', marginTop: 3, marginBottom: 5, paddingLeft: 30, gap: 6 }}>
|
|
104
|
+
<Text style={{ color: AppColors.grayTextWeak, fontSize: 9, fontFamily: AppFonts.interBold, letterSpacing: 0.5, marginTop: 2.5 }}>PATH</Text>
|
|
105
|
+
<HighlightText text={path} search={searchStr} style={{
|
|
106
|
+
fontFamily: AppFonts.Sfprotext || 'System',
|
|
107
|
+
fontSize: 12,
|
|
108
|
+
color: AppColors.grayText,
|
|
109
|
+
flex: 1,
|
|
110
|
+
}} highlightStyle={styles.highlight} numberOfLines={0}/>
|
|
111
|
+
</View>)}
|
|
112
|
+
|
|
100
113
|
<View style={styles.cardBottomRow}>
|
|
101
114
|
<View style={styles.cardDateRow}>
|
|
102
115
|
<CalendarIcon color={AppColors.grayTextWeak} size={11}/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "1.1.
|
|
1
|
+
export declare const LIB_VERSION = "1.1.9";
|
|
@@ -6,6 +6,7 @@ export declare const getDurationColor: (duration: number | null) => string;
|
|
|
6
6
|
export declare const getSize: (data: unknown) => string;
|
|
7
7
|
export declare const copyToClipboard: (value: unknown, label: string) => void;
|
|
8
8
|
export declare const getPath: (url: string) => string;
|
|
9
|
+
export declare const getBaseUrl: (url: string) => string;
|
|
9
10
|
export declare const getCurlCommand: (log: NetworkLog) => string;
|
|
10
11
|
export declare const getFetchCommand: (log: NetworkLog) => string;
|
|
11
12
|
export declare const deduplicateLogs: (raw: NetworkLog[]) => NetworkLog[];
|
|
@@ -73,6 +73,16 @@ export const getPath = (url) => {
|
|
|
73
73
|
return withoutDomain || '/';
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
+
export const getBaseUrl = (url) => {
|
|
77
|
+
try {
|
|
78
|
+
const u = new URL(url);
|
|
79
|
+
return `${u.protocol}//${u.host}`;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
const match = url.match(/^(https?:\/\/[^/]+)/);
|
|
83
|
+
return match ? match[1] : '';
|
|
84
|
+
}
|
|
85
|
+
};
|
|
76
86
|
export const getCurlCommand = (log) => {
|
|
77
87
|
let cmd = `curl -X ${log.method} "${log.url}"`;
|
|
78
88
|
if (log.requestHeaders) {
|
package/dist/esm/index.js
CHANGED
|
@@ -113,7 +113,7 @@ const NavigationTracker = ({ onStateChange }) => {
|
|
|
113
113
|
const animateNextLayout = () => {
|
|
114
114
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
115
115
|
};
|
|
116
|
-
const NetworkInspector = ({ enabled = true, storage, }) => {
|
|
116
|
+
const NetworkInspector = ({ enabled = true, storage, navigationRef, }) => {
|
|
117
117
|
// Set custom storage synchronously during render phase
|
|
118
118
|
setCustomStorage(storage || null);
|
|
119
119
|
const [isDark, setIsDark] = useState(false);
|
|
@@ -506,6 +506,36 @@ const NetworkInspector = ({ enabled = true, storage, }) => {
|
|
|
506
506
|
currentRouteRef.current = getNavigationInfo(navState);
|
|
507
507
|
}
|
|
508
508
|
}, [navState]);
|
|
509
|
+
useEffect(() => {
|
|
510
|
+
if (!navigationRef)
|
|
511
|
+
return;
|
|
512
|
+
const updateState = () => {
|
|
513
|
+
try {
|
|
514
|
+
if (typeof navigationRef.isReady === 'function' && navigationRef.isReady()) {
|
|
515
|
+
const state = navigationRef.getRootState();
|
|
516
|
+
if (state) {
|
|
517
|
+
setNavState(state);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
catch (err) {
|
|
522
|
+
// Safe check
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
// Initialize state
|
|
526
|
+
updateState();
|
|
527
|
+
// Listen to changes
|
|
528
|
+
const unsubscribe = typeof navigationRef.addListener === 'function'
|
|
529
|
+
? navigationRef.addListener('state', () => {
|
|
530
|
+
updateState();
|
|
531
|
+
})
|
|
532
|
+
: null;
|
|
533
|
+
return () => {
|
|
534
|
+
if (unsubscribe) {
|
|
535
|
+
unsubscribe();
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
}, [navigationRef]);
|
|
509
539
|
const logRouteMapRef = useRef(new Map());
|
|
510
540
|
const prevLogIdsRef = useRef(new Set());
|
|
511
541
|
const [newLogIds, setNewLogIds] = useState(new Set());
|
|
@@ -724,6 +724,9 @@ export declare const getRawStyles: (colors: typeof AppColors) => {
|
|
|
724
724
|
paddingVertical: number;
|
|
725
725
|
borderRadius: number;
|
|
726
726
|
marginRight: number;
|
|
727
|
+
minWidth: number;
|
|
728
|
+
alignItems: string;
|
|
729
|
+
justifyContent: string;
|
|
727
730
|
shadowColor: string;
|
|
728
731
|
shadowOffset: {
|
|
729
732
|
width: number;
|
package/dist/esm/styles/index.js
CHANGED
|
@@ -653,10 +653,13 @@ export const getRawStyles = (colors) => ({
|
|
|
653
653
|
fontSize: 10,
|
|
654
654
|
},
|
|
655
655
|
methodBadge: {
|
|
656
|
-
paddingHorizontal:
|
|
657
|
-
paddingVertical:
|
|
658
|
-
borderRadius:
|
|
659
|
-
marginRight:
|
|
656
|
+
paddingHorizontal: 6,
|
|
657
|
+
paddingVertical: 3,
|
|
658
|
+
borderRadius: 6,
|
|
659
|
+
marginRight: 6,
|
|
660
|
+
minWidth: 46,
|
|
661
|
+
alignItems: 'center',
|
|
662
|
+
justifyContent: 'center',
|
|
660
663
|
shadowColor: '#000000',
|
|
661
664
|
shadowOffset: { width: 0, height: 1 },
|
|
662
665
|
shadowOpacity: 0.08,
|
|
@@ -665,8 +668,8 @@ export const getRawStyles = (colors) => ({
|
|
|
665
668
|
},
|
|
666
669
|
methodBadgeText: {
|
|
667
670
|
fontFamily: AppFonts.interBold,
|
|
668
|
-
fontSize:
|
|
669
|
-
letterSpacing: 0.
|
|
671
|
+
fontSize: 9.5,
|
|
672
|
+
letterSpacing: 0.4,
|
|
670
673
|
},
|
|
671
674
|
timelineTrack: {
|
|
672
675
|
height: 3,
|
package/example/App.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useColorScheme,
|
|
10
10
|
} from 'react-native';
|
|
11
11
|
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
|
|
12
|
-
import { NavigationContainer } from '@react-navigation/native';
|
|
12
|
+
import { NavigationContainer, createNavigationContainerRef } from '@react-navigation/native';
|
|
13
13
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
14
14
|
import axios from 'axios';
|
|
15
15
|
import NetworkInspector, {
|
|
@@ -574,6 +574,7 @@ function WebViewScreen({ navigation }: any) {
|
|
|
574
574
|
}
|
|
575
575
|
|
|
576
576
|
const Stack = createNativeStackNavigator();
|
|
577
|
+
const navigationRef = createNavigationContainerRef();
|
|
577
578
|
|
|
578
579
|
function App() {
|
|
579
580
|
const isDarkMode = useColorScheme() === 'dark';
|
|
@@ -582,7 +583,7 @@ function App() {
|
|
|
582
583
|
<SafeAreaProvider>
|
|
583
584
|
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
|
|
584
585
|
<ErrorBoundary>
|
|
585
|
-
<NavigationContainer>
|
|
586
|
+
<NavigationContainer ref={navigationRef}>
|
|
586
587
|
<Stack.Navigator
|
|
587
588
|
screenOptions={{
|
|
588
589
|
headerShown: false,
|
|
@@ -597,7 +598,7 @@ function App() {
|
|
|
597
598
|
</Stack.Navigator>
|
|
598
599
|
</NavigationContainer>
|
|
599
600
|
{/* Render inspector globally exactly once at the root level */}
|
|
600
|
-
<NetworkInspector />
|
|
601
|
+
<NetworkInspector navigationRef={navigationRef} />
|
|
601
602
|
</ErrorBoundary>
|
|
602
603
|
</SafeAreaProvider>
|
|
603
604
|
);
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"eslint": "^8.19.0",
|
|
39
39
|
"jest": "^29.6.3",
|
|
40
40
|
"prettier": "2.8.8",
|
|
41
|
-
"react-native-inapp-inspector": "^1.1.
|
|
41
|
+
"react-native-inapp-inspector": "^1.1.8",
|
|
42
42
|
"react-test-renderer": "19.2.3",
|
|
43
43
|
"typescript": "^5.8.3"
|
|
44
44
|
},
|
|
@@ -10639,9 +10639,9 @@
|
|
|
10639
10639
|
}
|
|
10640
10640
|
},
|
|
10641
10641
|
"node_modules/react-native-inapp-inspector": {
|
|
10642
|
-
"version": "1.1.
|
|
10643
|
-
"resolved": "https://registry.npmjs.org/react-native-inapp-inspector/-/react-native-inapp-inspector-1.1.
|
|
10644
|
-
"integrity": "sha512-
|
|
10642
|
+
"version": "1.1.8",
|
|
10643
|
+
"resolved": "https://registry.npmjs.org/react-native-inapp-inspector/-/react-native-inapp-inspector-1.1.8.tgz",
|
|
10644
|
+
"integrity": "sha512-YxmzhE/qRz/KgGva4d0hrL5CpZKmNfAtxrUSTxNM+tD2D5ch686RwG9C+KyqqJvpfIBIxkZyBqoTp31NVGVgjA==",
|
|
10645
10645
|
"dev": true,
|
|
10646
10646
|
"license": "MIT",
|
|
10647
10647
|
"dependencies": {
|
package/example/package.json
CHANGED
package/package.json
CHANGED