react-native-network-lens 0.1.1 → 0.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.
Files changed (50) hide show
  1. package/README.md +254 -98
  2. package/lib/module/components/BodyViewer.js +30 -24
  3. package/lib/module/components/BodyViewer.js.map +1 -1
  4. package/lib/module/components/JsonTree/JsonTreeView.js +10 -6
  5. package/lib/module/components/JsonTree/JsonTreeView.js.map +1 -1
  6. package/lib/module/components/NetworkLens.js +4 -8
  7. package/lib/module/components/NetworkLens.js.map +1 -1
  8. package/lib/module/components/NetworkLensOverlay.js +67 -22
  9. package/lib/module/components/NetworkLensOverlay.js.map +1 -1
  10. package/lib/module/components/RawTextView.js +10 -6
  11. package/lib/module/components/RawTextView.js.map +1 -1
  12. package/lib/module/components/RequestDetails/RequestDetails.js +35 -17
  13. package/lib/module/components/RequestDetails/RequestDetails.js.map +1 -1
  14. package/lib/module/components/RequestList/RequestList.js +4 -5
  15. package/lib/module/components/RequestList/RequestList.js.map +1 -1
  16. package/lib/module/components/ui/Button.js +5 -3
  17. package/lib/module/components/ui/Button.js.map +1 -1
  18. package/lib/module/components/ui/Pill.js +13 -6
  19. package/lib/module/components/ui/Pill.js.map +1 -1
  20. package/lib/module/settings.js +48 -0
  21. package/lib/module/settings.js.map +1 -0
  22. package/lib/module/theme.js +4 -4
  23. package/lib/typescript/src/components/BodyViewer.d.ts.map +1 -1
  24. package/lib/typescript/src/components/JsonTree/JsonTreeView.d.ts.map +1 -1
  25. package/lib/typescript/src/components/NetworkLens.d.ts +0 -3
  26. package/lib/typescript/src/components/NetworkLens.d.ts.map +1 -1
  27. package/lib/typescript/src/components/NetworkLensOverlay.d.ts +1 -1
  28. package/lib/typescript/src/components/NetworkLensOverlay.d.ts.map +1 -1
  29. package/lib/typescript/src/components/RawTextView.d.ts.map +1 -1
  30. package/lib/typescript/src/components/RequestDetails/RequestDetails.d.ts.map +1 -1
  31. package/lib/typescript/src/components/RequestList/RequestList.d.ts +1 -4
  32. package/lib/typescript/src/components/RequestList/RequestList.d.ts.map +1 -1
  33. package/lib/typescript/src/components/ui/Button.d.ts +3 -1
  34. package/lib/typescript/src/components/ui/Button.d.ts.map +1 -1
  35. package/lib/typescript/src/components/ui/Pill.d.ts +1 -0
  36. package/lib/typescript/src/components/ui/Pill.d.ts.map +1 -1
  37. package/lib/typescript/src/settings.d.ts +18 -0
  38. package/lib/typescript/src/settings.d.ts.map +1 -0
  39. package/package.json +1 -1
  40. package/src/components/BodyViewer.tsx +36 -28
  41. package/src/components/JsonTree/JsonTreeView.tsx +11 -5
  42. package/src/components/NetworkLens.tsx +2 -11
  43. package/src/components/NetworkLensOverlay.tsx +54 -23
  44. package/src/components/RawTextView.tsx +11 -6
  45. package/src/components/RequestDetails/RequestDetails.tsx +26 -16
  46. package/src/components/RequestList/RequestList.tsx +1 -5
  47. package/src/components/ui/Button.tsx +17 -5
  48. package/src/components/ui/Pill.tsx +14 -5
  49. package/src/settings.ts +55 -0
  50. package/src/theme.ts +2 -2
package/README.md CHANGED
@@ -1,41 +1,116 @@
1
- # react-native-network-lens
2
-
3
- [![npm version](https://img.shields.io/npm/v/react-native-network-lens.svg)](https://www.npmjs.com/package/react-native-network-lens)
4
- [![CI](https://github.com/stainsmjohnson/react-native-network-lens/actions/workflows/ci.yml/badge.svg)](https://github.com/stainsmjohnson/react-native-network-lens/actions/workflows/ci.yml)
5
- [![license](https://img.shields.io/npm/l/react-native-network-lens.svg)](./LICENSE)
6
-
7
- In-app HTTP inspector for React Native, built for small screens.
8
-
9
- | Request list | JSON tree | Search | Raw view |
10
- | --- | --- | --- | --- |
11
- | ![Request list](docs/list.png) | ![JSON tree](docs/tree.png) | ![Search](docs/search.png) | ![Raw view](docs/raw.png) |
12
-
13
- A modern take on `react-native-network-logger`: the same zero-dependency XHR
14
- capture (so `fetch`, `axios`, Apollo, etc. are all covered), with a UI that is
15
- actually usable on a phone:
16
-
17
- - **Tabbed request details** – *Overview* (URL, timings, query params, request
18
- and response headers), *Request* payload and *Response* payload each get the
19
- full screen instead of a 300 px box.
20
- - **Collapsible JSON tree** – payloads render like the JavaScript console:
21
- expand only the object you care about, collapse the noise, long-press a node
22
- to copy or share it.
23
- - **No line wrapping** – both the tree and the pretty-printed *Raw* view scroll
24
- horizontally, so indentation and structure stay readable.
25
- - **Search inside payloads** – with match count and next/previous navigation
26
- that auto-expands and scrolls to the hit. Works in both Tree and Raw views.
27
- - **Better list** – colour-coded method and status, path/host split, duration,
28
- size, GraphQL operation names, pending spinners, failed/timed-out/aborted
29
- states, filters by method / status group / host, and a free-text filter.
30
- - **Feature flag built in** – `startNetworkLogging({ enabled })` and the
31
- `enabled` prop on every component turn the whole thing into a no-op, so it
32
- can be driven by `__DEV__`, a remote config value or a hidden dev setting.
33
- - **Floating overlay** – `<NetworkLensOverlay />` adds a badge button that opens
34
- the inspector in a modal. One line, done.
35
- - **Light / dark / auto themes**, cURL export, HAR export, share full request.
36
- - **Zero dependencies**, pure TypeScript, no native code. Works with the New
37
- Architecture and the old one. Supports React Native **0.69+** (React 18+);
38
- CI runs the example app on the latest release.
1
+ <h1 align="center">react-native-network-lens</h1>
2
+
3
+ <p align="center">
4
+ <strong>See every request your React Native app makes, right on the phone.</strong><br />
5
+ Tabbed request details · collapsible JSON tree · search · zero dependencies
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/react-native-network-lens"><img alt="npm version" src="https://img.shields.io/npm/v/react-native-network-lens?color=2563eb" /></a>
10
+ <a href="https://bundlephobia.com/package/react-native-network-lens"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/react-native-network-lens?label=min%2Bgzip" /></a>
11
+ <a href="https://www.npmjs.com/package/react-native-network-lens?activeTab=dependencies"><img alt="dependencies: none" src="https://img.shields.io/badge/dependencies-none-16a34a" /></a>
12
+ <a href="https://github.com/stainsmjohnson/react-native-network-lens/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/stainsmjohnson/react-native-network-lens/actions/workflows/ci.yml/badge.svg" /></a>
13
+ <img alt="TypeScript" src="https://img.shields.io/npm/types/react-native-network-lens" />
14
+ <img alt="platforms" src="https://img.shields.io/badge/platforms-iOS%20%7C%20Android%20%7C%20Expo-5b5b5b" />
15
+ <a href="./LICENSE"><img alt="license" src="https://img.shields.io/npm/l/react-native-network-lens" /></a>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://github.com/stainsmjohnson/react-native-network-lens/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/stainsmjohnson/react-native-network-lens?style=social&label=Star%20this%20project" /></a>
20
+ </p>
21
+
22
+ An in-app HTTP inspector for React Native that is actually usable on a phone
23
+ screen. Drop in one component, fire your requests, tap the floating button and
24
+ read JSON like you would in Chrome DevTools: expand the object you care about,
25
+ collapse the noise, search for a key, scroll sideways instead of fighting
26
+ wrapped text.
27
+
28
+ No native code, no Flipper, no desktop app, no debug build required. It works
29
+ in release builds too, so testers and QA can inspect traffic and share a cURL
30
+ or HAR with you from the device itself.
31
+
32
+ ## Screenshots
33
+
34
+ <p align="center">
35
+ <img src="docs/ios-list.png" width="200" alt="Request list on iOS" />
36
+ <img src="docs/ios-tree.png" width="200" alt="Collapsible JSON tree on iOS" />
37
+ <img src="docs/ios-search.png" width="200" alt="Searching inside a response" />
38
+ <img src="docs/ios-raw.png" width="200" alt="Raw view with line numbers" />
39
+ </p>
40
+ <p align="center">
41
+ <img src="docs/android-list.png" width="200" alt="Request list on Android" />
42
+ <img src="docs/android-tree.png" width="200" alt="JSON tree on Android" />
43
+ <img src="docs/ios-list-dark.png" width="200" alt="Dark theme list" />
44
+ <img src="docs/ios-tree-dark.png" width="200" alt="Dark theme JSON tree" />
45
+ </p>
46
+
47
+ ## Why another network logger?
48
+
49
+ [`react-native-network-logger`](https://github.com/alexbrazier/react-native-network-logger)
50
+ proved that an in-app, zero-dependency inspector is the right idea. This
51
+ library keeps that idea and rebuilds the UI for small screens.
52
+
53
+ | | react-native-network-lens | react-native-network-logger | Flipper / Reactotron |
54
+ | --- | :---: | :---: | :---: |
55
+ | Works on device, no desktop app | ✅ | ✅ | ❌ |
56
+ | Works in release builds | ✅ | ✅ | ❌ |
57
+ | Zero dependencies, no native code | ✅ | ✅ | ❌ |
58
+ | Separate tabs for headers, request, response | ✅ | ❌ | ✅ |
59
+ | Collapsible JSON tree (console style) | ✅ | ❌ | ✅ |
60
+ | Horizontal scrolling, no wrapped JSON | ✅ | ❌ | ✅ |
61
+ | Search inside a payload with next / previous | ✅ | ❌ | ✅ |
62
+ | Adjustable code font size | ✅ | ❌ | – |
63
+ | Failed / timed-out / aborted states | ✅ | ❌ | ✅ |
64
+ | Filter by method, status group, host | ✅ | partial | ✅ |
65
+ | Feature flag built in (`enabled`) | ✅ | ❌ | – |
66
+ | Floating overlay button | ✅ | ❌ | – |
67
+ | Light / dark / follows system | ✅ | light / dark | – |
68
+ | cURL and HAR export | ✅ | ✅ | ✅ |
69
+ | Supports React Native | 0.69+ | 0.60+ | varies |
70
+
71
+ ## Features
72
+
73
+ **Capture**
74
+
75
+ - Intercepts `XMLHttpRequest`, which means `fetch`, axios, Apollo, Relay, RTK
76
+ Query and every other JS networking library are covered.
77
+ - Records request and response headers, bodies, status, timing, size, and
78
+ GraphQL operation names.
79
+ - Distinguishes pending, done, failed, timed out and aborted requests.
80
+ - Ring buffer with a configurable limit, pause/resume, and ignore rules by
81
+ host, exact URL or regex.
82
+
83
+ **Inspect**
84
+
85
+ - Request list with colour-coded method and status, path/host split,
86
+ duration, size and a live counter of requests with errors.
87
+ - Free-text filter plus chips for method, status group (2xx…5xx, pending,
88
+ failed) and host.
89
+ - Details in three tabs: **Overview** (URL, timings, query parameters,
90
+ request and response headers), **Request** body and **Response** body.
91
+ - Bodies render as a collapsible tree like the JavaScript console, or as
92
+ pretty-printed raw text with line numbers. Both scroll horizontally and
93
+ virtualise rows, so multi-megabyte payloads stay smooth.
94
+ - Search inside a body with match count and next / previous; the tree expands
95
+ and scrolls to each hit.
96
+ - "Aa" button cycles the code font size. Long-press any tree node to copy or
97
+ share just that value.
98
+
99
+ **Share**
100
+
101
+ - Share a body, the headers, a cURL command, the full request as JSON, or all
102
+ requests as a HAR file that Chrome, Charles and Proxyman can import.
103
+ - Plug in your clipboard library with one prop to get Copy buttons everywhere.
104
+
105
+ **Integrate**
106
+
107
+ - `<NetworkLensOverlay />` adds a floating badge that opens the inspector in a
108
+ modal. `<NetworkLens />` renders it inline inside your own screen.
109
+ - `enabled` flag on everything: wire it to `__DEV__`, a remote config value or
110
+ a hidden developer setting.
111
+ - Light, dark or follow-the-system themes, fully overridable.
112
+ - Written in TypeScript, works with the New Architecture and the old one,
113
+ survives Fast Refresh.
39
114
 
40
115
  ## Installation
41
116
 
@@ -45,19 +120,20 @@ yarn add react-native-network-lens
45
120
  npm install react-native-network-lens
46
121
  ```
47
122
 
48
- No pod install, no Gradle changes.
123
+ No `pod install`, no Gradle changes, no Expo config plugin. Requires React
124
+ Native 0.69+ and React 18+.
49
125
 
50
126
  ## Quick start
51
127
 
52
128
  ```tsx
53
- // index.js – as early as possible so nothing is missed
129
+ // index.js — as early as possible so nothing is missed
54
130
  import { startNetworkLogging } from 'react-native-network-lens';
55
131
 
56
132
  startNetworkLogging({ enabled: __DEV__ });
57
133
  ```
58
134
 
59
135
  ```tsx
60
- // App.tsx – the one-liner overlay
136
+ // App.tsx
61
137
  import { NetworkLensOverlay } from 'react-native-network-lens';
62
138
 
63
139
  export default function App() {
@@ -70,23 +146,38 @@ export default function App() {
70
146
  }
71
147
  ```
72
148
 
73
- Tap the floating **NET** button to open the inspector. It shows the number of
74
- captured requests and turns red when something failed.
149
+ Tap the floating **NET** button. It shows how many requests were captured and
150
+ turns red when something failed.
75
151
 
76
- ### Rendering it as a screen instead
152
+ ## Recipes
153
+
154
+ ### As a screen in your navigator
77
155
 
78
156
  ```tsx
79
157
  import { NetworkLens } from 'react-native-network-lens';
80
158
 
81
- const NetworkScreen = () => <NetworkLens theme="dark" />;
159
+ const NetworkScreen = () => <NetworkLens />;
82
160
  ```
83
161
 
84
- `NetworkLens` fills its parent (`flex: 1`). Put it inside your own screen /
85
- navigator; it handles the Android hardware back button for the details view.
162
+ `NetworkLens` fills its parent (`flex: 1`) and handles the Android hardware
163
+ back button for the details view. To make your own header back button step
164
+ out of the details view first:
165
+
166
+ ```tsx
167
+ import { NetworkLens, getBackHandler } from 'react-native-network-lens';
86
168
 
87
- ### Conditionally enabling (feature flag)
169
+ const NetworkScreen = ({ navigation }) => {
170
+ const onBack = getBackHandler(navigation.goBack);
171
+ return (
172
+ <>
173
+ <Header onBackPress={onBack} />
174
+ <NetworkLens />
175
+ </>
176
+ );
177
+ };
178
+ ```
88
179
 
89
- Everything respects a single flag:
180
+ ### Behind a feature flag or hidden gesture
90
181
 
91
182
  ```tsx
92
183
  const inspectorEnabled = __DEV__ || remoteConfig.getBoolean('network_inspector');
@@ -96,9 +187,58 @@ startNetworkLogging({ enabled: inspectorEnabled });
96
187
  <NetworkLensOverlay enabled={inspectorEnabled} />
97
188
  ```
98
189
 
99
- When `enabled` is `false`, `XMLHttpRequest` is left untouched and the
100
- components render `null`. You can also call `stopNetworkLogging()` at runtime
101
- to turn it off and free the captured data.
190
+ Prefer your own trigger (shake gesture, dev menu, tapping the version label
191
+ seven times)? Hide the button and control the sheet yourself:
192
+
193
+ ```tsx
194
+ const [open, setOpen] = useState(false);
195
+
196
+ <NetworkLensOverlay hideButton visible={open} onVisibleChange={setOpen} />
197
+ ```
198
+
199
+ ### Copy buttons
200
+
201
+ The library ships no native code, so clipboard access is opt-in:
202
+
203
+ ```tsx
204
+ import Clipboard from '@react-native-clipboard/clipboard';
205
+
206
+ <NetworkLensOverlay copyToClipboard={Clipboard.setString} />
207
+ ```
208
+
209
+ ### Expo
210
+
211
+ Works in Expo Go and development builds without a config plugin. Call
212
+ `startNetworkLogging()` at the top of your root layout or `App.tsx`.
213
+
214
+ ### Keeping noise out
215
+
216
+ ```tsx
217
+ startNetworkLogging({
218
+ ignoredHosts: ['localhost:8081', 'firebaselogging.googleapis.com'],
219
+ ignoredPatterns: [/^HEAD /, /\/analytics\//],
220
+ maxRequests: 300,
221
+ });
222
+ ```
223
+
224
+ ### Alongside Reactotron, Flipper or Sentry
225
+
226
+ Other tools also patch `XMLHttpRequest`. react-native-network-lens patches on
227
+ top of whatever is already there and restores it on `stopNetworkLogging()`,
228
+ so they can run together.
229
+
230
+ ### Using the data yourself
231
+
232
+ ```tsx
233
+ import { useNetworkRequests, createHar } from 'react-native-network-lens';
234
+
235
+ const FailedCount = () => {
236
+ const requests = useNetworkRequests();
237
+ return <Text>{requests.filter((r) => r.state === 'failed').length}</Text>;
238
+ };
239
+
240
+ const har = await createHar(getRequests());
241
+ ```
102
242
 
103
243
  ## API
104
244
 
@@ -106,59 +246,48 @@ to turn it off and free the captured data.
106
246
 
107
247
  | Option | Type | Default | Description |
108
248
  | ----------------- | ---------- | ------- | ----------- |
109
- | `enabled` | `boolean` | `true` | Master switch. `false` makes the call a no-op (and stops a running logger). |
249
+ | `enabled` | `boolean` | `true` | Master switch. `false` makes the call a no-op and stops a running logger. |
110
250
  | `maxRequests` | `number` | `500` | Ring-buffer size. |
111
251
  | `ignoredHosts` | `string[]` | | Hosts to skip, e.g. `['localhost:8081']`. |
112
252
  | `ignoredUrls` | `string[]` | | Exact URLs to skip. |
113
253
  | `ignoredPatterns` | `RegExp[]` | | Tested against `"${method} ${url}"`. |
114
254
  | `refreshRate` | `number` | `50` | UI update throttle in ms. |
115
255
 
116
- Other functions: `stopNetworkLogging()`, `isNetworkLoggingEnabled()`,
256
+ Also exported: `stopNetworkLogging()`, `isNetworkLoggingEnabled()`,
117
257
  `getRequests()`, `clearRequests()`, `setNetworkLoggingPaused(bool)`,
118
- `getBackHandler(fn)` and `createHar(requests)`.
258
+ `getBackHandler(fn)`, `createHar(requests)`.
119
259
 
120
260
  ### `<NetworkLens />`
121
261
 
122
- | Prop | Type | Default |
123
- | -------------------- | -------------------------------------- | ------------ |
124
- | `enabled` | `boolean` | `true` |
125
- | `theme` | `'light' \| 'dark' \| 'auto' \| Partial<Theme>` | `'auto'` |
126
- | `sort` | `'asc' \| 'desc'` | `'desc'` |
127
- | `compact` | `boolean` | `false` |
128
- | `maxRows` | `number` | |
129
- | `copyToClipboard` | `(text: string) => void` | |
130
- | `header` | `ReactNode` rendered above the search bar | |
131
-
132
- A `ref` gives you `goBack(): boolean`, which returns from the details view to
133
- the list. Use it to wire your own back button or modal `onRequestClose`.
134
-
135
- The library ships no native code, so there is no clipboard access by default.
136
- Pass your clipboard function to get **Copy** buttons everywhere:
262
+ | Prop | Type | Default |
263
+ | ----------------- | ------------------------------------------------- | -------- |
264
+ | `enabled` | `boolean` | `true` |
265
+ | `theme` | `'light' \| 'dark' \| 'auto' \| Partial<Theme>` | `'auto'` |
266
+ | `sort` | `'asc' \| 'desc'` | `'desc'` |
267
+ | `compact` | `boolean` | `false` |
268
+ | `maxRows` | `number` | |
269
+ | `copyToClipboard` | `(text: string) => void` | |
137
270
 
138
- ```tsx
139
- import Clipboard from '@react-native-clipboard/clipboard';
140
-
141
- <NetworkLensOverlay copyToClipboard={Clipboard.setString} />
142
- ```
271
+ A `ref` exposes `goBack(): boolean`, which returns from the details view to
272
+ the list (handy for your own back button or a modal's `onRequestClose`).
143
273
 
144
274
  ### `<NetworkLensOverlay />`
145
275
 
146
276
  All `NetworkLens` props plus:
147
277
 
148
- | Prop | Type | Default |
149
- | ----------------- | ----------------------------------------------------------- | ---------------- |
150
- | `position` | `'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left'` | `'bottom-right'` |
151
- | `offset` | `{ x?: number; y?: number }` | `{ x: 16, y: 32 }` |
152
- | `visible` / `onVisibleChange` | controlled visibility of the modal | |
153
- | `hideButton` | `boolean` – open it from your own dev menu instead | `false` |
154
- | `title` | `string` | `'Network'` |
278
+ | Prop | Type | Default |
279
+ | ----------------------------- | -------------------------------------------------------------- | ---------------- |
280
+ | `position` | `'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left'` | `'bottom-right'` |
281
+ | `offset` | `{ x?: number; y?: number }` | `{ x: 16, y: 32 }` |
282
+ | `visible` / `onVisibleChange` | controlled visibility of the sheet | |
283
+ | `hideButton` | `boolean` | `false` |
284
+ | `title` | `string` | `'Network'` |
155
285
 
156
286
  ### Hooks and building blocks
157
287
 
158
- - `useNetworkRequests()` – live array of `NetworkRequest` objects.
288
+ - `useNetworkRequests()` – live array of `NetworkRequest` objects, newest first.
159
289
  - `useLoggerEnabled()`, `useLoggerPaused()`.
160
- - `JsonTreeView` is exported so you can reuse the collapsible JSON viewer
161
- elsewhere in your debug tooling.
290
+ - `JsonTreeView` – the collapsible JSON viewer, reusable in your own debug UI.
162
291
 
163
292
  ### Theming
164
293
 
@@ -166,23 +295,34 @@ All `NetworkLens` props plus:
166
295
  <NetworkLens theme={{ colors: { primary: '#ff5c8a', jsonKey: '#ffd166' } }} />
167
296
  ```
168
297
 
169
- Any colour you omit falls back to the light or dark theme depending on the
170
- system appearance. See `Theme` in `src/theme.ts` for every token.
298
+ Colours you omit fall back to the light or dark theme depending on the system
299
+ appearance. `theme.sizes.codeFontSize` (default 14) sets the base code size;
300
+ users can still cycle small / medium / large with the **Aa** button. See
301
+ `Theme` in `src/theme.ts` for every token.
302
+
303
+ ## Compatibility
304
+
305
+ | | |
306
+ | --- | --- |
307
+ | React Native | 0.69 and newer (CI builds the example on the latest release) |
308
+ | React | 18 and newer |
309
+ | Architecture | New Architecture and legacy, Hermes and JSC |
310
+ | Expo | Expo Go and development builds, no config plugin |
311
+ | Platforms | iOS, Android. Web is untested. |
171
312
 
172
313
  ## How it works
173
314
 
174
- The library patches `XMLHttpRequest.prototype` (`open`, `setRequestHeader`,
175
- `send`) when `startNetworkLogging()` runs and restores the originals on
176
- `stopNetworkLogging()`. Every callback is wrapped so a bug in the inspector can
177
- never break a request. Captured requests live in a single store on
178
- `globalThis`, which survives Fast Refresh, and React reads it through
179
- `useSyncExternalStore`. There is no native code, so nothing to link.
315
+ `startNetworkLogging()` patches `XMLHttpRequest.prototype` (`open`,
316
+ `setRequestHeader`, `send`) and `stopNetworkLogging()` restores the originals.
317
+ Every callback is wrapped so a bug in the inspector can never break a request.
318
+ Captured requests live in one store on `globalThis`, which survives Fast
319
+ Refresh, and React reads it through `useSyncExternalStore`.
180
320
 
181
321
  ## Security
182
322
 
183
323
  The inspector keeps captured headers and bodies in memory, including
184
324
  authorization tokens and cookies, and lets the user share or export them.
185
- Ship it behind `__DEV__` or an internal flag only, and use `ignoredHosts` /
325
+ Ship it behind `__DEV__` or an internal flag, and use `ignoredHosts` /
186
326
  `ignoredPatterns` for endpoints that must never be captured. See
187
327
  [SECURITY.md](SECURITY.md) for details and how to report issues.
188
328
 
@@ -193,17 +333,33 @@ The public API is a superset: `startNetworkLogging`, `stopNetworkLogging`,
193
333
  component keep working. Differences:
194
334
 
195
335
  - `theme` accepts `'auto'` and defaults to it.
336
+ - `forceEnable` is gone; the interceptor coexists with other tools.
196
337
  - Requests expose `state` (`pending | done | failed`) and `failureReason`
197
338
  (`error | timeout | abort`) instead of staying "pending" forever.
198
339
  - Bodies are parsed into `{ kind: 'json' | 'form' | 'text' | 'binary' | 'empty' }`
199
340
  via `request.getRequestBody()` / `await request.getResponseBody()`.
200
341
 
342
+ ## FAQ
343
+
344
+ **Nothing shows up.** Call `startNetworkLogging()` before the first request,
345
+ ideally at the top of `index.js`, and make sure `enabled` is not `false`.
346
+
347
+ **Can I ship it to production?** Yes, behind a flag. The library is small and
348
+ inert when `enabled` is `false`. Read the Security section first.
349
+
350
+ **Does it see native networking (Image, video, native SDKs)?** No. Only
351
+ requests that go through JavaScript's `XMLHttpRequest`, which is everything
352
+ your JS code sends.
353
+
201
354
  ## Contributing
202
355
 
203
- See the [contributing guide](CONTRIBUTING.md). The example app in `example/`
204
- fires a variety of requests (large JSON, nested objects, forms, GraphQL-like,
205
- errors, timeouts, binary) so you can try every screen.
356
+ Issues and pull requests are welcome. See the
357
+ [contributing guide](CONTRIBUTING.md); the example app in `example/` fires a
358
+ variety of requests (large JSON, nested objects, forms, GraphQL-like, errors,
359
+ timeouts, binary) so every screen can be tried in a minute.
360
+
361
+ If this library saves you time, a ⭐ on GitHub helps others find it.
206
362
 
207
363
  ## License
208
364
 
209
- MIT
365
+ MIT © [Stains M Johnson](https://github.com/stainsmjohnson)
@@ -7,8 +7,9 @@ import { bodySize, stringifyJson } from "../utils/body.js";
7
7
  import { formatBytes } from "../utils/format.js";
8
8
  import JsonTreeView from "./JsonTree/JsonTreeView.js";
9
9
  import RawTextView from "./RawTextView.js";
10
- import { ActionSheet, EmptyState, SearchInput, SegmentedControl, TextButton } from "./ui/index.js";
11
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
+ import { cycleCodeFontScale, useCodeFontScale } from "../settings.js";
11
+ import { ActionSheet, EmptyState, IconButton, SearchInput, SegmentedControl } from "./ui/index.js";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
13
  const KIND_LABEL = {
13
14
  json: 'JSON',
14
15
  form: 'Form data',
@@ -41,6 +42,8 @@ const BodyViewer = ({
41
42
  const [matchIndex, setMatchIndex] = useState(0);
42
43
  const [nodeMenu, setNodeMenu] = useState(null);
43
44
  const treeRef = useRef(null);
45
+ const [menuVisible, setMenuVisible] = useState(false);
46
+ const fontScale = useCodeFontScale();
44
47
  const effectiveMode = structured ? mode : 'raw';
45
48
  useEffect(() => setMatchIndex(0), [query, effectiveMode, body]);
46
49
  const onMatchCountChange = useCallback(count => {
@@ -99,24 +102,14 @@ const BodyViewer = ({
99
102
  children: meta
100
103
  }), /*#__PURE__*/_jsx(View, {
101
104
  style: styles.spacer
102
- }), effectiveMode === 'tree' && /*#__PURE__*/_jsxs(_Fragment, {
103
- children: [/*#__PURE__*/_jsx(TextButton, {
104
- label: "Expand",
105
- onPress: () => treeRef.current?.expandAll(),
106
- style: styles.toolButton
107
- }), /*#__PURE__*/_jsx(TextButton, {
108
- label: "Collapse",
109
- onPress: () => treeRef.current?.collapseAll(),
110
- style: styles.toolButton
111
- })]
112
- }), copyToClipboard && body.kind !== 'binary' && /*#__PURE__*/_jsx(TextButton, {
113
- label: "Copy",
114
- onPress: () => copyToClipboard(body.text),
115
- style: styles.toolButton
116
- }), /*#__PURE__*/_jsx(TextButton, {
117
- label: "Share",
118
- onPress: () => share(body.text),
119
- style: styles.toolButton
105
+ }), /*#__PURE__*/_jsx(IconButton, {
106
+ glyph: "Aa",
107
+ accessibilityLabel: `Text size: ${fontScale}. Tap to change`,
108
+ onPress: cycleCodeFontScale
109
+ }), /*#__PURE__*/_jsx(IconButton, {
110
+ glyph: "\u22EE",
111
+ accessibilityLabel: "More options",
112
+ onPress: () => setMenuVisible(true)
120
113
  })]
121
114
  }), body.kind !== 'binary' && /*#__PURE__*/_jsx(SearchInput, {
122
115
  value: query,
@@ -150,6 +143,22 @@ const BodyViewer = ({
150
143
  activeMatch: matchIndex,
151
144
  onMatchCountChange: onMatchCountChange
152
145
  })
146
+ }), /*#__PURE__*/_jsx(ActionSheet, {
147
+ visible: menuVisible,
148
+ onClose: () => setMenuVisible(false),
149
+ actions: [...(effectiveMode === 'tree' ? [{
150
+ label: 'Expand all',
151
+ onPress: () => treeRef.current?.expandAll()
152
+ }, {
153
+ label: 'Collapse all',
154
+ onPress: () => treeRef.current?.collapseAll()
155
+ }] : []), ...(copyToClipboard && body.kind !== 'binary' ? [{
156
+ label: 'Copy',
157
+ onPress: () => copyToClipboard(body.text)
158
+ }] : []), {
159
+ label: 'Share',
160
+ onPress: () => share(body.text)
161
+ }]
153
162
  }), /*#__PURE__*/_jsx(ActionSheet, {
154
163
  visible: nodeMenu !== null,
155
164
  onClose: () => setNodeMenu(null),
@@ -183,10 +192,7 @@ const styles = StyleSheet.create({
183
192
  paddingTop: 10
184
193
  },
185
194
  modeSwitch: {
186
- width: 130
187
- },
188
- toolButton: {
189
- marginLeft: 6
195
+ width: 140
190
196
  },
191
197
  spacer: {
192
198
  flex: 1
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","ActivityIndicator","Share","StyleSheet","Text","View","useTheme","bodySize","stringifyJson","formatBytes","JsonTreeView","RawTextView","ActionSheet","EmptyState","SearchInput","SegmentedControl","TextButton","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","KIND_LABEL","json","form","text","binary","empty","share","message","catch","undefined","valueText","value","BodyViewer","body","loading","emptyTitle","emptySubtitle","copyToClipboard","theme","structured","kind","mode","setMode","query","setQuery","matchCount","setMatchCount","matchIndex","setMatchIndex","nodeMenu","setNodeMenu","treeRef","effectiveMode","onMatchCountChange","count","index","Math","min","matches","onNext","i","onPrev","meta","parts","mimeType","push","size","split","length","join","style","styles","center","children","color","colors","primary","title","subtitle","container","toolbar","onChange","options","label","modeSwitch","textMuted","numberOfLines","spacer","onPress","current","expandAll","toolButton","collapseAll","onChangeText","placeholder","search","metaBelow","viewer","borderColor","border","ref","activeMatch","onLongPressNode","visible","onClose","path","actions","create","flex","alignItems","justifyContent","flexDirection","paddingHorizontal","paddingTop","width","marginLeft","marginHorizontal","marginTop","fontSize","flexShrink","borderTopWidth","hairlineWidth"],"sourceRoot":"../../../src","sources":["components/BodyViewer.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SAASC,iBAAiB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAC/E,SAASC,QAAQ,QAAQ,aAAU;AAEnC,SAASC,QAAQ,EAAEC,aAAa,QAAQ,kBAAe;AACvD,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,OAAOC,YAAY,MAA+B,4BAAyB;AAC3E,OAAOC,WAAW,MAAM,kBAAe;AACvC,SACEC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,gBAAgB,EAChBC,UAAU,QACL,eAAM;AAAC,SAAAC,GAAA,IAA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,iBAAiB,EAAE,EAAE;IAAEC,UAAU,EAAE;EAAE,CAAC;EACnDhB,MAAM,EAAE;IAAEW,IAAI,EAAE,CAAC;IAAES,SAAS,EAAE,CAAC;IAAEG,cAAc,EAAExH,UAAU,CAACyH;EAAc;AAC5E,CAAC,CAAC;AAEF,eAAezF,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","ActivityIndicator","Share","StyleSheet","Text","View","useTheme","bodySize","stringifyJson","formatBytes","JsonTreeView","RawTextView","cycleCodeFontScale","useCodeFontScale","ActionSheet","EmptyState","IconButton","SearchInput","SegmentedControl","jsx","_jsx","jsxs","_jsxs","KIND_LABEL","json","form","text","binary","empty","share","message","catch","undefined","valueText","value","BodyViewer","body","loading","emptyTitle","emptySubtitle","copyToClipboard","theme","structured","kind","mode","setMode","query","setQuery","matchCount","setMatchCount","matchIndex","setMatchIndex","nodeMenu","setNodeMenu","treeRef","menuVisible","setMenuVisible","fontScale","effectiveMode","onMatchCountChange","count","index","Math","min","matches","onNext","i","onPrev","meta","parts","mimeType","push","size","split","length","join","style","styles","center","children","color","colors","primary","title","subtitle","container","toolbar","onChange","options","label","modeSwitch","textMuted","numberOfLines","spacer","glyph","accessibilityLabel","onPress","onChangeText","placeholder","search","metaBelow","viewer","borderColor","border","ref","activeMatch","onLongPressNode","visible","onClose","actions","current","expandAll","collapseAll","path","create","flex","alignItems","justifyContent","flexDirection","paddingHorizontal","paddingTop","width","marginHorizontal","marginTop","fontSize","flexShrink","borderTopWidth","hairlineWidth"],"sourceRoot":"../../../src","sources":["components/BodyViewer.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SAASC,iBAAiB,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAC/E,SAASC,QAAQ,QAAQ,aAAU;AAEnC,SAASC,QAAQ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