react-native-network-lens 0.1.0 → 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 (57) hide show
  1. package/README.md +254 -97
  2. package/lib/module/components/BodyViewer.js +31 -19
  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/JsonTree/model.js +2 -0
  7. package/lib/module/components/JsonTree/model.js.map +1 -1
  8. package/lib/module/components/NetworkLens.js +4 -8
  9. package/lib/module/components/NetworkLens.js.map +1 -1
  10. package/lib/module/components/NetworkLensOverlay.js +67 -22
  11. package/lib/module/components/NetworkLensOverlay.js.map +1 -1
  12. package/lib/module/components/RawTextView.js +10 -6
  13. package/lib/module/components/RawTextView.js.map +1 -1
  14. package/lib/module/components/RequestDetails/RequestDetails.js +44 -21
  15. package/lib/module/components/RequestDetails/RequestDetails.js.map +1 -1
  16. package/lib/module/components/RequestList/FilterBar.js +3 -3
  17. package/lib/module/components/RequestList/FilterBar.js.map +1 -1
  18. package/lib/module/components/RequestList/RequestList.js +7 -8
  19. package/lib/module/components/RequestList/RequestList.js.map +1 -1
  20. package/lib/module/components/ui/Button.js +21 -5
  21. package/lib/module/components/ui/Button.js.map +1 -1
  22. package/lib/module/components/ui/Pill.js +13 -6
  23. package/lib/module/components/ui/Pill.js.map +1 -1
  24. package/lib/module/settings.js +48 -0
  25. package/lib/module/settings.js.map +1 -0
  26. package/lib/module/theme.js +4 -4
  27. package/lib/typescript/src/components/BodyViewer.d.ts.map +1 -1
  28. package/lib/typescript/src/components/JsonTree/JsonTreeView.d.ts.map +1 -1
  29. package/lib/typescript/src/components/JsonTree/model.d.ts.map +1 -1
  30. package/lib/typescript/src/components/NetworkLens.d.ts +0 -3
  31. package/lib/typescript/src/components/NetworkLens.d.ts.map +1 -1
  32. package/lib/typescript/src/components/NetworkLensOverlay.d.ts +1 -1
  33. package/lib/typescript/src/components/NetworkLensOverlay.d.ts.map +1 -1
  34. package/lib/typescript/src/components/RawTextView.d.ts.map +1 -1
  35. package/lib/typescript/src/components/RequestDetails/RequestDetails.d.ts.map +1 -1
  36. package/lib/typescript/src/components/RequestList/RequestList.d.ts +1 -4
  37. package/lib/typescript/src/components/RequestList/RequestList.d.ts.map +1 -1
  38. package/lib/typescript/src/components/ui/Button.d.ts +3 -1
  39. package/lib/typescript/src/components/ui/Button.d.ts.map +1 -1
  40. package/lib/typescript/src/components/ui/Pill.d.ts +1 -0
  41. package/lib/typescript/src/components/ui/Pill.d.ts.map +1 -1
  42. package/lib/typescript/src/settings.d.ts +18 -0
  43. package/lib/typescript/src/settings.d.ts.map +1 -0
  44. package/package.json +3 -3
  45. package/src/components/BodyViewer.tsx +37 -19
  46. package/src/components/JsonTree/JsonTreeView.tsx +11 -5
  47. package/src/components/JsonTree/model.ts +2 -0
  48. package/src/components/NetworkLens.tsx +2 -11
  49. package/src/components/NetworkLensOverlay.tsx +54 -23
  50. package/src/components/RawTextView.tsx +11 -6
  51. package/src/components/RequestDetails/RequestDetails.tsx +31 -19
  52. package/src/components/RequestList/FilterBar.tsx +2 -2
  53. package/src/components/RequestList/RequestList.tsx +3 -7
  54. package/src/components/ui/Button.tsx +23 -7
  55. package/src/components/ui/Pill.tsx +14 -5
  56. package/src/settings.ts +55 -0
  57. package/src/theme.ts +2 -2
package/README.md CHANGED
@@ -1,40 +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 React Native **0.83+**.
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.
38
114
 
39
115
  ## Installation
40
116
 
@@ -44,19 +120,20 @@ yarn add react-native-network-lens
44
120
  npm install react-native-network-lens
45
121
  ```
46
122
 
47
- 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+.
48
125
 
49
126
  ## Quick start
50
127
 
51
128
  ```tsx
52
- // index.js – as early as possible so nothing is missed
129
+ // index.js — as early as possible so nothing is missed
53
130
  import { startNetworkLogging } from 'react-native-network-lens';
54
131
 
55
132
  startNetworkLogging({ enabled: __DEV__ });
56
133
  ```
57
134
 
58
135
  ```tsx
59
- // App.tsx – the one-liner overlay
136
+ // App.tsx
60
137
  import { NetworkLensOverlay } from 'react-native-network-lens';
61
138
 
62
139
  export default function App() {
@@ -69,23 +146,38 @@ export default function App() {
69
146
  }
70
147
  ```
71
148
 
72
- Tap the floating **NET** button to open the inspector. It shows the number of
73
- 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.
74
151
 
75
- ### Rendering it as a screen instead
152
+ ## Recipes
153
+
154
+ ### As a screen in your navigator
76
155
 
77
156
  ```tsx
78
157
  import { NetworkLens } from 'react-native-network-lens';
79
158
 
80
- const NetworkScreen = () => <NetworkLens theme="dark" />;
159
+ const NetworkScreen = () => <NetworkLens />;
81
160
  ```
82
161
 
83
- `NetworkLens` fills its parent (`flex: 1`). Put it inside your own screen /
84
- 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';
85
168
 
86
- ### 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
+ ```
87
179
 
88
- Everything respects a single flag:
180
+ ### Behind a feature flag or hidden gesture
89
181
 
90
182
  ```tsx
91
183
  const inspectorEnabled = __DEV__ || remoteConfig.getBoolean('network_inspector');
@@ -95,9 +187,58 @@ startNetworkLogging({ enabled: inspectorEnabled });
95
187
  <NetworkLensOverlay enabled={inspectorEnabled} />
96
188
  ```
97
189
 
98
- When `enabled` is `false`, `XMLHttpRequest` is left untouched and the
99
- components render `null`. You can also call `stopNetworkLogging()` at runtime
100
- 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
+ ```
101
242
 
102
243
  ## API
103
244
 
@@ -105,59 +246,48 @@ to turn it off and free the captured data.
105
246
 
106
247
  | Option | Type | Default | Description |
107
248
  | ----------------- | ---------- | ------- | ----------- |
108
- | `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. |
109
250
  | `maxRequests` | `number` | `500` | Ring-buffer size. |
110
251
  | `ignoredHosts` | `string[]` | | Hosts to skip, e.g. `['localhost:8081']`. |
111
252
  | `ignoredUrls` | `string[]` | | Exact URLs to skip. |
112
253
  | `ignoredPatterns` | `RegExp[]` | | Tested against `"${method} ${url}"`. |
113
254
  | `refreshRate` | `number` | `50` | UI update throttle in ms. |
114
255
 
115
- Other functions: `stopNetworkLogging()`, `isNetworkLoggingEnabled()`,
256
+ Also exported: `stopNetworkLogging()`, `isNetworkLoggingEnabled()`,
116
257
  `getRequests()`, `clearRequests()`, `setNetworkLoggingPaused(bool)`,
117
- `getBackHandler(fn)` and `createHar(requests)`.
258
+ `getBackHandler(fn)`, `createHar(requests)`.
118
259
 
119
260
  ### `<NetworkLens />`
120
261
 
121
- | Prop | Type | Default |
122
- | -------------------- | -------------------------------------- | ------------ |
123
- | `enabled` | `boolean` | `true` |
124
- | `theme` | `'light' \| 'dark' \| 'auto' \| Partial<Theme>` | `'auto'` |
125
- | `sort` | `'asc' \| 'desc'` | `'desc'` |
126
- | `compact` | `boolean` | `false` |
127
- | `maxRows` | `number` | |
128
- | `copyToClipboard` | `(text: string) => void` | |
129
- | `header` | `ReactNode` rendered above the search bar | |
130
-
131
- A `ref` gives you `goBack(): boolean`, which returns from the details view to
132
- the list. Use it to wire your own back button or modal `onRequestClose`.
133
-
134
- The library ships no native code, so there is no clipboard access by default.
135
- 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` | |
136
270
 
137
- ```tsx
138
- import Clipboard from '@react-native-clipboard/clipboard';
139
-
140
- <NetworkLensOverlay copyToClipboard={Clipboard.setString} />
141
- ```
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`).
142
273
 
143
274
  ### `<NetworkLensOverlay />`
144
275
 
145
276
  All `NetworkLens` props plus:
146
277
 
147
- | Prop | Type | Default |
148
- | ----------------- | ----------------------------------------------------------- | ---------------- |
149
- | `position` | `'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left'` | `'bottom-right'` |
150
- | `offset` | `{ x?: number; y?: number }` | `{ x: 16, y: 32 }` |
151
- | `visible` / `onVisibleChange` | controlled visibility of the modal | |
152
- | `hideButton` | `boolean` – open it from your own dev menu instead | `false` |
153
- | `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'` |
154
285
 
155
286
  ### Hooks and building blocks
156
287
 
157
- - `useNetworkRequests()` – live array of `NetworkRequest` objects.
288
+ - `useNetworkRequests()` – live array of `NetworkRequest` objects, newest first.
158
289
  - `useLoggerEnabled()`, `useLoggerPaused()`.
159
- - `JsonTreeView` is exported so you can reuse the collapsible JSON viewer
160
- elsewhere in your debug tooling.
290
+ - `JsonTreeView` – the collapsible JSON viewer, reusable in your own debug UI.
161
291
 
162
292
  ### Theming
163
293
 
@@ -165,23 +295,34 @@ All `NetworkLens` props plus:
165
295
  <NetworkLens theme={{ colors: { primary: '#ff5c8a', jsonKey: '#ffd166' } }} />
166
296
  ```
167
297
 
168
- Any colour you omit falls back to the light or dark theme depending on the
169
- 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. |
170
312
 
171
313
  ## How it works
172
314
 
173
- The library patches `XMLHttpRequest.prototype` (`open`, `setRequestHeader`,
174
- `send`) when `startNetworkLogging()` runs and restores the originals on
175
- `stopNetworkLogging()`. Every callback is wrapped so a bug in the inspector can
176
- never break a request. Captured requests live in a single store on
177
- `globalThis`, which survives Fast Refresh, and React reads it through
178
- `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`.
179
320
 
180
321
  ## Security
181
322
 
182
323
  The inspector keeps captured headers and bodies in memory, including
183
324
  authorization tokens and cookies, and lets the user share or export them.
184
- Ship it behind `__DEV__` or an internal flag only, and use `ignoredHosts` /
325
+ Ship it behind `__DEV__` or an internal flag, and use `ignoredHosts` /
185
326
  `ignoredPatterns` for endpoints that must never be captured. See
186
327
  [SECURITY.md](SECURITY.md) for details and how to report issues.
187
328
 
@@ -192,17 +333,33 @@ The public API is a superset: `startNetworkLogging`, `stopNetworkLogging`,
192
333
  component keep working. Differences:
193
334
 
194
335
  - `theme` accepts `'auto'` and defaults to it.
336
+ - `forceEnable` is gone; the interceptor coexists with other tools.
195
337
  - Requests expose `state` (`pending | done | failed`) and `failureReason`
196
338
  (`error | timeout | abort`) instead of staying "pending" forever.
197
339
  - Bodies are parsed into `{ kind: 'json' | 'form' | 'text' | 'binary' | 'empty' }`
198
340
  via `request.getRequestBody()` / `await request.getResponseBody()`.
199
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
+
200
354
  ## Contributing
201
355
 
202
- See the [contributing guide](CONTRIBUTING.md). The example app in `example/`
203
- fires a variety of requests (large JSON, nested objects, forms, GraphQL-like,
204
- 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.
205
362
 
206
363
  ## License
207
364
 
208
- 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,20 +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
- }), /*#__PURE__*/_jsx(TextButton, {
107
- label: "Collapse",
108
- onPress: () => treeRef.current?.collapseAll()
109
- })]
110
- }), copyToClipboard && body.kind !== 'binary' && /*#__PURE__*/_jsx(TextButton, {
111
- label: "Copy",
112
- onPress: () => copyToClipboard(body.text)
113
- }), /*#__PURE__*/_jsx(TextButton, {
114
- label: "Share",
115
- onPress: () => share(body.text)
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)
116
113
  })]
117
114
  }), body.kind !== 'binary' && /*#__PURE__*/_jsx(SearchInput, {
118
115
  value: query,
@@ -146,6 +143,22 @@ const BodyViewer = ({
146
143
  activeMatch: matchIndex,
147
144
  onMatchCountChange: onMatchCountChange
148
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
+ }]
149
162
  }), /*#__PURE__*/_jsx(ActionSheet, {
150
163
  visible: nodeMenu !== null,
151
164
  onClose: () => setNodeMenu(null),
@@ -176,11 +189,10 @@ const styles = StyleSheet.create({
176
189
  flexDirection: 'row',
177
190
  alignItems: 'center',
178
191
  paddingHorizontal: 12,
179
- paddingTop: 10,
180
- gap: 6
192
+ paddingTop: 10
181
193
  },
182
194
  modeSwitch: {
183
- width: 130
195
+ width: 140
184
196
  },
185
197
  spacer: {
186
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","collapseAll","onChangeText","placeholder","search","metaBelow","viewer","borderColor","border","ref","activeMatch","onLongPressNode","visible","onClose","path","actions","create","flex","alignItems","justifyContent","flexDirection","paddingHorizontal","paddingTop","gap","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,EAAEC,aAAa,QAAQ,kBAAe;AACvD,SAASC,WA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E,EAAE;IAAEC,UAAU,EAAE;EAAE,CAAC;EACnDhB,MAAM,EAAE;IAAEW,IAAI,EAAE,CAAC;IAAES,SAAS,EAAE,CAAC;IAAEG,cAAc,EAAEvH,UAAU,CAACwH;EAAc;AAC5E,CAAC,CAAC;AAEF,eAAexF,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,EAAEC,aAA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