react-native-inapp-inspector 1.1.35 → 2.0.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.
- package/README.md +123 -101
- package/android/build.gradle +13 -1
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +904 -0
- package/android/src/main/java/com/inappinspector/NetworkInspectorPackage.kt +17 -0
- package/dist/commonjs/components/CopyButton.js +3 -0
- package/dist/commonjs/components/ErrorBoundary.js +3 -0
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +7 -3
- package/dist/commonjs/components/Inspector/BundleTab.js +1 -1
- package/dist/commonjs/components/Inspector/ConsoleTab.js +1 -1
- package/dist/commonjs/components/Inspector/CrashTab.js +97 -90
- package/dist/commonjs/components/Inspector/InspectorHeader.js +12 -8
- package/dist/commonjs/components/Inspector/MainScreen.js +14 -101
- package/dist/commonjs/components/Inspector/NetworkTab.js +47 -10
- package/dist/commonjs/components/Inspector/PerformanceTab.js +96 -3
- package/dist/commonjs/components/Inspector/ReduxTab.js +18 -10
- package/dist/commonjs/components/Inspector/SettingsPanel.js +342 -88
- package/dist/commonjs/components/Inspector/TabBar.js +6 -3
- package/dist/commonjs/components/NetworkIcons.d.ts +1 -0
- package/dist/commonjs/components/NetworkIcons.js +6 -1
- package/dist/commonjs/components/TouchableScale.d.ts +1 -0
- package/dist/commonjs/components/TouchableScale.js +30 -32
- package/dist/commonjs/constants/index.d.ts +1 -2
- package/dist/commonjs/constants/index.js +4 -0
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +4 -0
- package/dist/commonjs/customHooks/analyticsLogger.js +7 -5
- package/dist/commonjs/customHooks/crashHandler.js +7 -0
- package/dist/commonjs/helpers/index.js +10 -1
- package/dist/commonjs/helpers/settingsStore.d.ts +9 -0
- package/dist/commonjs/helpers/settingsStore.js +59 -3
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.js +229 -39
- package/dist/commonjs/native/NativeInspector.d.ts +125 -0
- package/dist/commonjs/native/NativeInspector.js +313 -0
- package/dist/commonjs/native/NativeNetworkInspector.d.ts +22 -0
- package/dist/commonjs/native/NativeNetworkInspector.js +4 -0
- package/dist/commonjs/styles/index.js +6 -6
- package/dist/commonjs/types/enums.d.ts +1 -1
- package/dist/commonjs/types/interfaces.d.ts +9 -0
- package/dist/esm/components/CopyButton.js +3 -0
- package/dist/esm/components/ErrorBoundary.js +3 -0
- package/dist/esm/components/Inspector/AnalyticsTab.js +7 -3
- package/dist/esm/components/Inspector/BundleTab.js +1 -1
- package/dist/esm/components/Inspector/ConsoleTab.js +1 -1
- package/dist/esm/components/Inspector/CrashTab.js +97 -90
- package/dist/esm/components/Inspector/InspectorHeader.js +13 -9
- package/dist/esm/components/Inspector/MainScreen.js +15 -69
- package/dist/esm/components/Inspector/NetworkTab.js +47 -10
- package/dist/esm/components/Inspector/PerformanceTab.js +96 -3
- package/dist/esm/components/Inspector/ReduxTab.js +18 -10
- package/dist/esm/components/Inspector/SettingsPanel.js +344 -90
- package/dist/esm/components/Inspector/TabBar.js +7 -4
- package/dist/esm/components/NetworkIcons.d.ts +1 -0
- package/dist/esm/components/NetworkIcons.js +4 -0
- package/dist/esm/components/TouchableScale.d.ts +1 -0
- package/dist/esm/components/TouchableScale.js +31 -33
- package/dist/esm/constants/index.d.ts +1 -2
- package/dist/esm/constants/index.js +4 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/analyticsLogger.d.ts +4 -0
- package/dist/esm/customHooks/analyticsLogger.js +5 -4
- package/dist/esm/customHooks/crashHandler.js +7 -0
- package/dist/esm/helpers/index.js +10 -1
- package/dist/esm/helpers/settingsStore.d.ts +9 -0
- package/dist/esm/helpers/settingsStore.js +58 -3
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +215 -39
- package/dist/esm/native/NativeInspector.d.ts +125 -0
- package/dist/esm/native/NativeInspector.js +289 -0
- package/dist/esm/native/NativeNetworkInspector.d.ts +22 -0
- package/dist/esm/native/NativeNetworkInspector.js +2 -0
- package/dist/esm/styles/index.js +6 -6
- package/dist/esm/types/enums.d.ts +1 -1
- package/dist/esm/types/interfaces.d.ts +9 -0
- package/ios/NetworkInspectorModule.h +6 -0
- package/ios/NetworkInspectorModule.m +720 -5
- package/package.json +13 -2
- package/react-native-inapp-inspector.podspec +7 -2
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.java +0 -97
- package/android/src/main/java/com/inappinspector/NetworkInspectorPackage.java +0 -28
package/README.md
CHANGED
|
@@ -31,7 +31,10 @@ The **zero-config, all-in-one in-app debugging overlay for React Native & Expo**
|
|
|
31
31
|
|
|
32
32
|
| Capability | **react-native-inapp-inspector** | react-native-network-logger | Flipper / RN Debugger |
|
|
33
33
|
| :--- | :---: | :---: | :---: |
|
|
34
|
-
| **
|
|
34
|
+
| **Native Module (Kotlin & iOS Bridge)** | ✅ | ❌ | ⚠️ |
|
|
35
|
+
| **Low-Level Hardware & RAM Telemetry** | ✅ | ❌ | ⚠️ |
|
|
36
|
+
| **Zero-Render Inactive Mode (0% Background Overhead)** | ✅ | ❌ | ❌ |
|
|
37
|
+
| **Network Timing Waterfall & P95 Telemetry** | ✅ | ❌ | ✅ |
|
|
35
38
|
| **Network Inspector (Fetch & Axios)** | ✅ | ✅ | ✅ |
|
|
36
39
|
| **cURL & Fetch Snippet Export** | ✅ | ❌ | ⚠️ |
|
|
37
40
|
| **Console Logger + Stack Traces** | ✅ (Metro Symbolicated) | ❌ | ✅ |
|
|
@@ -47,14 +50,16 @@ The **zero-config, all-in-one in-app debugging overlay for React Native & Expo**
|
|
|
47
50
|
|
|
48
51
|
| Feature | Description |
|
|
49
52
|
| --- | --- |
|
|
53
|
+
| ⚡ **Native Hardware Telemetry** | Native Kotlin (`Android`) & Objective-C (`iOS`) bridge to query total RAM, available RAM, native heap size, internal storage free space, battery level, charging status, and CPU ABI. |
|
|
54
|
+
| 🌊 **Network Timing Waterfall** | Latency breakdown with visual proportional waterfall bars, performance ratings (Fast `<200ms`, Moderate `200-800ms`, Slow `>800ms`), and aggregate **Success Rate %**, **Avg Latency**, and **P95 Latency** health indicators. |
|
|
55
|
+
| 🚀 **Zero-Render Inactive Mode** | High-performance architecture that eliminates background React re-renders while the inspector modal is closed, synchronizing state instantaneously upon opening. |
|
|
50
56
|
| 🌐 **Network Inspector** | Intercepts `fetch` and Axios (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`). Inspect status codes, request/response headers, body JSON, duration, caller origin, and instant cURL / fetch export snippets. |
|
|
51
57
|
| 🪵 **Console Logger & Stack Trace** | Captures `console.log`, `info`, `warn`, and `error`. Displays trigger file (`TSX`, `JSX`, `TS`, `JS`) & line numbers via **Metro Symbolication**, call stack frames, individual arguments inspection, and duplicate collapsing (`×N`). |
|
|
52
58
|
| ⏸️ **Live Stream Pause / Resume** | Freeze incoming network requests, console logs, and analytics streams on the fly to inspect active traffic without list jumping. |
|
|
53
59
|
| 📊 **Analytics Tracker** | Tracks manual events and auto-patches `@react-native-firebase/analytics` calls (`logEvent`, `logScreenView`, `setUserProperties`, and `setUserId`). |
|
|
54
60
|
| 🔄 **Redux State & Actions** | Connects to Redux / Redux Toolkit. Inspect dispatched actions with deep state diffs, payload breakdown, slice state trees, and `redux-persist` metadata. |
|
|
55
61
|
| 📦 **Bundle Visualizer** | In-app JavaScript bundle size breakdown, Hermes engine bytecode metrics, visual package treemap, and integrated `react-native-bundle-visualizer` CLI. |
|
|
56
|
-
|
|
|
57
|
-
| 🛡️ **Error Boundary** | Built-in `ErrorBoundary` to gracefully catch and inspect React render crashes. |
|
|
62
|
+
| 🛡️ **Error Boundary & Native Crash Catcher** | Built-in React `ErrorBoundary` and native exception/signal crash catcher emitting rich stack traces and device diagnostics. |
|
|
58
63
|
|
|
59
64
|
---
|
|
60
65
|
|
|
@@ -90,11 +95,11 @@ The package requires React (`>=18.0.0`) and React Native (`>=0.60.0`) as peer de
|
|
|
90
95
|
|
|
91
96
|
---
|
|
92
97
|
|
|
93
|
-
## 🚀 Basic Setup
|
|
98
|
+
## 🚀 Basic Setup (JavaScript & TypeScript)
|
|
94
99
|
|
|
95
|
-
Mount `<NetworkInspector />` near the root of your application:
|
|
100
|
+
Mount `<NetworkInspector />` near the root of your application (e.g. in `App.js` or `App.tsx`):
|
|
96
101
|
|
|
97
|
-
```
|
|
102
|
+
```jsx
|
|
98
103
|
import React from 'react';
|
|
99
104
|
import {SafeAreaView} from 'react-native';
|
|
100
105
|
import NetworkInspector from 'react-native-inapp-inspector';
|
|
@@ -117,7 +122,7 @@ When mounted, the inspector automatically sets up network logging, intercepts co
|
|
|
117
122
|
|
|
118
123
|
If your application makes API calls before the root component finishes mounting, initialize the logger at the module level in your entry file (`index.js` or `App.tsx`):
|
|
119
124
|
|
|
120
|
-
```
|
|
125
|
+
```javascript
|
|
121
126
|
import NetworkInspector, {
|
|
122
127
|
setupNetworkLogger,
|
|
123
128
|
setupConsoleLogger,
|
|
@@ -127,16 +132,39 @@ setupNetworkLogger();
|
|
|
127
132
|
setupConsoleLogger();
|
|
128
133
|
```
|
|
129
134
|
|
|
130
|
-
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## ⚡ Native Hardware & Memory Telemetry
|
|
131
138
|
|
|
132
|
-
|
|
139
|
+
Access native low-level device, battery, and memory metrics:
|
|
133
140
|
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
```javascript
|
|
142
|
+
import {
|
|
143
|
+
getNativeDeviceMetrics,
|
|
144
|
+
enableNativeCrashProtection,
|
|
145
|
+
subscribeNativeCrashes
|
|
146
|
+
} from 'react-native-inapp-inspector';
|
|
137
147
|
|
|
138
|
-
//
|
|
139
|
-
|
|
148
|
+
// Fetch hardware & memory metrics
|
|
149
|
+
async function logStats() {
|
|
150
|
+
const metrics = await getNativeDeviceMetrics();
|
|
151
|
+
if (metrics) {
|
|
152
|
+
console.log('Model:', metrics.deviceModel, metrics.osVersion);
|
|
153
|
+
console.log('Total RAM:', (metrics.totalRAM / (1024 * 1024)).toFixed(0), 'MB');
|
|
154
|
+
console.log('Free RAM:', (metrics.freeRAM / (1024 * 1024)).toFixed(0), 'MB');
|
|
155
|
+
console.log('Native Heap:', (metrics.nativeHeapAllocated / (1024 * 1024)).toFixed(1), 'MB');
|
|
156
|
+
console.log('Free Storage:', (metrics.freeStorage / (1024 * 1024 * 1024)).toFixed(2), 'GB');
|
|
157
|
+
console.log('Battery:', `${metrics.batteryPercent}% (Charging: ${metrics.isCharging})`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Enable native crash protection
|
|
162
|
+
enableNativeCrashProtection();
|
|
163
|
+
|
|
164
|
+
// Subscribe to native crash events
|
|
165
|
+
const unsubscribe = subscribeNativeCrashes((crash) => {
|
|
166
|
+
console.log('Native Exception:', crash.error, crash.stack);
|
|
167
|
+
});
|
|
140
168
|
```
|
|
141
169
|
|
|
142
170
|
---
|
|
@@ -145,8 +173,8 @@ You can disable or hide the floating launcher overlay conditionally:
|
|
|
145
173
|
|
|
146
174
|
The console logger provides deep insight into every `console.log`, `info`, `warn`, and `error` call:
|
|
147
175
|
|
|
148
|
-
- **Metro Source Map Symbolication**:
|
|
149
|
-
- **
|
|
176
|
+
- **Metro Source Map Symbolication**: Stack traces are automatically symbolicated against Metro to point directly to your exact project source files (`HomeScreen.tsx:42:15`, `App.js:20`).
|
|
177
|
+
- **Vector SVG Category Tags**: Clean vector icons for `[TEST]`, `[API]`, `[REDUX]`, `[ANALYTICS]`, `[AUTH]`, `[WARN]`, `[ERROR]` tags.
|
|
150
178
|
- **Detailed Sub-Tabs**:
|
|
151
179
|
- **Output / Message**: Full message with JSON Viewer (Pretty, Raw, Table modes) and link detection.
|
|
152
180
|
- **Args (N)**: Inspect each passed argument individually with type detection (`Array[5]`, `Object{4}`).
|
|
@@ -154,18 +182,13 @@ The console logger provides deep insight into every `console.log`, `info`, `warn
|
|
|
154
182
|
- **Error Stack**: Automatically captures the thrown Error stack trace when logging Error objects.
|
|
155
183
|
- **Metadata**: Structured table of log properties, timestamp, character count, and duplicate counter.
|
|
156
184
|
|
|
157
|
-
```tsx
|
|
158
|
-
console.log('[API] User authenticated successfully', {userId: 42, role: 'admin'});
|
|
159
|
-
console.error(new Error('Payment gateway timeout'));
|
|
160
|
-
```
|
|
161
|
-
|
|
162
185
|
---
|
|
163
186
|
|
|
164
|
-
## 🌐 Network Logging
|
|
187
|
+
## 🌐 Network Logging & Latency Waterfall
|
|
165
188
|
|
|
166
189
|
`setupNetworkLogger()` intercepts global `fetch`, the default Axios instance, and instances created with `axios.create()`.
|
|
167
190
|
|
|
168
|
-
```
|
|
191
|
+
```javascript
|
|
169
192
|
import axios from 'axios';
|
|
170
193
|
import {setupNetworkLogger} from 'react-native-inapp-inspector';
|
|
171
194
|
|
|
@@ -177,13 +200,10 @@ await fetch('https://api.example.com/users');
|
|
|
177
200
|
await api.post('/login', {email, password});
|
|
178
201
|
```
|
|
179
202
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
addAxiosInterceptors(api);
|
|
186
|
-
```
|
|
203
|
+
The APIs tab features:
|
|
204
|
+
- **Telemetry Strip**: Real-time **Success Rate %**, **Avg Latency (ms)**, and **P95 Latency (ms)**.
|
|
205
|
+
- **Timing Waterfall**: Color-coded latency progress bars on each request card and duration benchmarks in request details.
|
|
206
|
+
- **cURL & Fetch Export**: Instant copyable commands for debugging in Postman, Charles, or Terminal.
|
|
187
207
|
|
|
188
208
|
---
|
|
189
209
|
|
|
@@ -191,18 +211,7 @@ addAxiosInterceptors(api);
|
|
|
191
211
|
|
|
192
212
|
Connect your Redux store once during application startup:
|
|
193
213
|
|
|
194
|
-
```
|
|
195
|
-
import {connectReduxStore} from 'react-native-inapp-inspector';
|
|
196
|
-
import store from './store';
|
|
197
|
-
|
|
198
|
-
connectReduxStore(store);
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### RTK Query, Thunks & Sagas (Recommended)
|
|
202
|
-
|
|
203
|
-
To capture actions dispatched from inside async thunks, sagas, or RTK Query, add `inspectorReduxMiddleware`:
|
|
204
|
-
|
|
205
|
-
```tsx
|
|
214
|
+
```javascript
|
|
206
215
|
import {configureStore} from '@reduxjs/toolkit';
|
|
207
216
|
import {inspectorReduxMiddleware, connectReduxStore} from 'react-native-inapp-inspector';
|
|
208
217
|
import rootReducer from './slices';
|
|
@@ -216,42 +225,13 @@ const store = configureStore({
|
|
|
216
225
|
connectReduxStore(store);
|
|
217
226
|
```
|
|
218
227
|
|
|
219
|
-
The Redux tab provides:
|
|
220
|
-
- **Action History**: Action type badge, timestamp, payload size, affected slices, deep state diffs, and snapshot viewer.
|
|
221
|
-
- **Slice Tree**: Live state tree per slice, persisted slice detection (`_persist`), search filtering, and JSON table exploration.
|
|
222
|
-
|
|
223
|
-
---
|
|
224
|
-
|
|
225
|
-
## 📊 Analytics Logging
|
|
226
|
-
|
|
227
|
-
Log manual analytics events or connect Firebase Analytics:
|
|
228
|
-
|
|
229
|
-
```tsx
|
|
230
|
-
import {logAnalyticsEvent} from 'react-native-inapp-inspector';
|
|
231
|
-
|
|
232
|
-
logAnalyticsEvent('purchase_completed', {
|
|
233
|
-
item_id: 'SKU-42',
|
|
234
|
-
value: 29.99,
|
|
235
|
-
currency: 'USD',
|
|
236
|
-
});
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### Firebase Analytics Integration
|
|
240
|
-
|
|
241
|
-
```tsx
|
|
242
|
-
import analytics from '@react-native-firebase/analytics';
|
|
243
|
-
import {setupAnalyticsLogger} from 'react-native-inapp-inspector';
|
|
244
|
-
|
|
245
|
-
setupAnalyticsLogger(analytics());
|
|
246
|
-
```
|
|
247
|
-
|
|
248
228
|
---
|
|
249
229
|
|
|
250
230
|
## 🧭 Navigation & Screen Tracking
|
|
251
231
|
|
|
252
232
|
To group network requests, logs, and analytics by the active screen, pass your navigation container ref:
|
|
253
233
|
|
|
254
|
-
```
|
|
234
|
+
```jsx
|
|
255
235
|
import {NavigationContainer, createNavigationContainerRef} from '@react-navigation/native';
|
|
256
236
|
import NetworkInspector from 'react-native-inapp-inspector';
|
|
257
237
|
|
|
@@ -271,25 +251,13 @@ const App = () => {
|
|
|
271
251
|
|
|
272
252
|
---
|
|
273
253
|
|
|
274
|
-
## 📦 Application Bundle Size & Asset Inspector
|
|
275
|
-
|
|
276
|
-
The inspector includes a dedicated **Bundle** tab (placed right after Redux) with **5 specialized sub-tabs** to inspect and optimize bundle assets:
|
|
277
|
-
|
|
278
|
-
1. 📊 **Overview & Treemap**: Real-time stacked visual ratio bar, total bundle size (`MB`), Hermes Bytecode engine detection, and category weight cards.
|
|
279
|
-
2. 📁 **Files Explorer**: Searchable file-by-file footprint breakdown (`PNG`, `TSX`, `JS`, `TTF`, `JSON`) with lines, resolution, and optimization status.
|
|
280
|
-
3. 📦 **Packages**: Node modules footprint audit (`react-native`, `@react-navigation`, `axios`, `react-native-svg`), version tags, and direct vs. transitive dependency analysis.
|
|
281
|
-
4. 🖼️ **Media Auditor**: Dedicated asset compression analysis for images and custom fonts with potential WebP savings calculators.
|
|
282
|
-
5. ⚡ **Optimizer Checklist**: Actionable best-practice tips for Hermes engine, selective path imports (tree-shaking), font subsetting, and screen lazy-loading.
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
254
|
## ⚙️ Settings Persistence
|
|
287
255
|
|
|
288
256
|
Inspector preferences (dark mode, active modules, default landing tab) persist across app launches:
|
|
289
257
|
- **iOS**: Uses React Native's built-in `Settings` module (`NSUserDefaults`) with zero extra configuration.
|
|
290
258
|
- **Android / Custom Storage**: Pass `@react-native-async-storage/async-storage` or `react-native-mmkv` to the `storage` prop:
|
|
291
259
|
|
|
292
|
-
```
|
|
260
|
+
```jsx
|
|
293
261
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
294
262
|
|
|
295
263
|
<NetworkInspector storage={AsyncStorage} />
|
|
@@ -297,18 +265,72 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
|
297
265
|
|
|
298
266
|
---
|
|
299
267
|
|
|
300
|
-
##
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
268
|
+
## 🏛️ Full Native Migration Guide (Native Core + JS Bridge API)
|
|
269
|
+
|
|
270
|
+
If you wish to migrate the inspector's entire UI and data engine to **100% Native (Kotlin / Swift)** while keeping a seamless, zero-friction JavaScript API for React Native developers, follow this architectural roadmap:
|
|
271
|
+
|
|
272
|
+
```mermaid
|
|
273
|
+
flowchart TB
|
|
274
|
+
subgraph React Native / JavaScript Layer
|
|
275
|
+
JS_App[Host React Native App]
|
|
276
|
+
JS_Bridge[Thin TS API: setupNetworkLogger / connectRedux / NativeInspector]
|
|
277
|
+
JS_App -->|Logs, Redux, Analytics| JS_Bridge
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
subgraph Native iOS / Android Engine
|
|
281
|
+
Native_Store[(Native Circular Ring Buffer & SQLite Storage)]
|
|
282
|
+
Native_Overlay[100% Native Floating Overlay & Window]
|
|
283
|
+
Native_Modal[Native Inspector Modal: SwiftUI / Compose / UIKit]
|
|
284
|
+
Native_Network[Native OkHttp Interceptor & NSURLProtocol]
|
|
285
|
+
|
|
286
|
+
JS_Bridge <-->|JSI / TurboModules / Event Emitters| Native_Store
|
|
287
|
+
Native_Network -->|Direct Native Traffic| Native_Store
|
|
288
|
+
Native_Overlay -->|Taps & Gestures| Native_Modal
|
|
289
|
+
Native_Store -->|Instant 120 FPS Rendering| Native_Modal
|
|
290
|
+
end
|
|
310
291
|
```
|
|
311
292
|
|
|
293
|
+
### Step-by-Step Migration Plan
|
|
294
|
+
|
|
295
|
+
#### Step 1: Native Floating Overlay & Gesture Engine *(Completed)*
|
|
296
|
+
- **iOS:** Floating `UIWindow` or root `UIView` subview at `UIWindowLevelAlert` with `UIPanGestureRecognizer` and edge-snapping physics on `[NSOperationQueue mainQueue]`.
|
|
297
|
+
- **Android:** Custom `FrameLayout` attached to `activity.window.decorView` with hardware-accelerated `OnTouchListener` running on the Main Looper.
|
|
298
|
+
- **Benefit:** 100% immune to JS thread stalls, instant 120 FPS drag response.
|
|
299
|
+
|
|
300
|
+
#### Step 2: Native Full-Screen Inspector Modal
|
|
301
|
+
- **iOS (UIKit / SwiftUI):**
|
|
302
|
+
- Create an `InspectorViewController` or SwiftUI `InspectorView`.
|
|
303
|
+
- When the floating icon is tapped, present it via `rootViewController.presentViewController:animated:completion:` directly on the native main thread.
|
|
304
|
+
- **Android (Jetpack Compose / XML View):**
|
|
305
|
+
- Create an `InspectorBottomSheetDialogFragment` or full-screen `DialogFragment`.
|
|
306
|
+
- Present with `fragmentManager.beginTransaction()` from `currentActivity`.
|
|
307
|
+
- **Benefit:** Searching 10,000+ network calls and expanding multi-megabyte JSON payloads occurs natively with virtualized lists and zero React re-render overhead.
|
|
308
|
+
|
|
309
|
+
#### Step 3: Native Network Interception (OkHttp & NSURLProtocol)
|
|
310
|
+
- **Android:** Add an `OkHttpInterceptor` into React Native's `OkHttpClientProvider.setOkHttpClientFactory` or custom client. Captures headers, byte streams, and timing without touching JavaScript `fetch` proxies.
|
|
311
|
+
- **iOS:** Register a custom `NSURLProtocol` on `[NSURLSessionConfiguration defaultSessionConfiguration]` to intercept low-level iOS network traffic globally.
|
|
312
|
+
- **Benefit:** Intercepts 3rd-party native SDK calls (Firebase, Stripe, AWS, Native Image loaders) in addition to JavaScript `fetch`/Axios requests.
|
|
313
|
+
|
|
314
|
+
#### Step 4: High-Performance JSI / C++ Shared Store
|
|
315
|
+
- Use React Native's **JSI (JavaScript Interface)** to share memory directly between C++/Kotlin/Swift and Hermes/JSC without JSON serialization over the legacy bridge.
|
|
316
|
+
- Expose synchronous methods:
|
|
317
|
+
```ts
|
|
318
|
+
// JSI Direct Memory Calls (0ms latency):
|
|
319
|
+
global.__InAppInspector_log(item);
|
|
320
|
+
global.__InAppInspector_getLogs();
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### Step 5: Preserve JavaScript Backwards Compatibility
|
|
324
|
+
- Keep existing JS exports (`setupNetworkLogger`, `connectReduxStore`, `logAnalyticsEvent`, `<NetworkInspector />`).
|
|
325
|
+
- The TS wrapper transparently forwards data into the native store:
|
|
326
|
+
```ts
|
|
327
|
+
export const logAnalyticsEvent = (name: string, params?: Record<string, any>) => {
|
|
328
|
+
if (NativeModules.NetworkInspectorModule?.logEvent) {
|
|
329
|
+
NativeModules.NetworkInspectorModule.logEvent(name, params);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
```
|
|
333
|
+
|
|
312
334
|
---
|
|
313
335
|
|
|
314
336
|
## 📚 Public API Reference
|
|
@@ -316,6 +338,9 @@ import {ErrorBoundary} from 'react-native-inapp-inspector';
|
|
|
316
338
|
| Export | Type | Description |
|
|
317
339
|
| --- | --- | --- |
|
|
318
340
|
| `NetworkInspector` | Component | Floating inspector overlay. Mount near app root. |
|
|
341
|
+
| `getNativeDeviceMetrics()` | Function | Returns native RAM, heap, disk, battery, and hardware metrics. |
|
|
342
|
+
| `enableNativeCrashProtection()` | Function | Enables native signal & uncaught exception protection. |
|
|
343
|
+
| `subscribeNativeCrashes(cb)` | Function | Subscribes to native crash events. |
|
|
319
344
|
| `setupNetworkLogger()` | Function | Patches `fetch`, default Axios, and future `axios.create()` instances. |
|
|
320
345
|
| `addAxiosInterceptors(instance)` | Function | Manually attaches Axios interceptors to an existing instance. |
|
|
321
346
|
| `clearNetworkLogs()` | Function | Clears captured network requests. |
|
|
@@ -325,14 +350,8 @@ import {ErrorBoundary} from 'react-native-inapp-inspector';
|
|
|
325
350
|
| `subscribeConsoleLogs(cb)` | Function | Subscribes to console log updates. |
|
|
326
351
|
| `connectReduxStore(store)` | Function | Connects a Redux store for state and action inspection. |
|
|
327
352
|
| `inspectorReduxMiddleware` | Middleware | Redux middleware for capturing thunks, sagas, and RTK Query actions. |
|
|
328
|
-
| `getReduxState()` | Function | Returns the current captured Redux state snapshot. |
|
|
329
|
-
| `subscribeReduxState(cb)` | Function | Subscribes to Redux state changes. |
|
|
330
|
-
| `getActionHistory()` | Function | Returns the history of dispatched Redux actions. |
|
|
331
|
-
| `clearActionHistory()` | Function | Clears Redux action history. |
|
|
332
353
|
| `setupAnalyticsLogger(instance)` | Function | Patches a Firebase Analytics instance. |
|
|
333
354
|
| `logAnalyticsEvent(name, params?, userProps?)` | Function | Logs a manual analytics event. |
|
|
334
|
-
| `clearAnalyticsEvents()` | Function | Clears captured analytics events. |
|
|
335
|
-
| `subscribeAnalyticsEvents(cb)` | Function | Subscribes to analytics event updates. |
|
|
336
355
|
| `ErrorBoundary` | Component | React error boundary component. |
|
|
337
356
|
|
|
338
357
|
---
|
|
@@ -346,6 +365,8 @@ cd example
|
|
|
346
365
|
npm install
|
|
347
366
|
cd ios && pod install && cd ..
|
|
348
367
|
npm run ios
|
|
368
|
+
# or
|
|
369
|
+
npm run android
|
|
349
370
|
```
|
|
350
371
|
|
|
351
372
|
---
|
|
@@ -369,3 +390,4 @@ This library is a free, open-source utility maintained in spare time. If it save
|
|
|
369
390
|
## 📄 License
|
|
370
391
|
|
|
371
392
|
MIT © [vengatmacuser](LICENSE)
|
|
393
|
+
|
package/android/build.gradle
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
+
ext.kotlin_version = '1.9.22'
|
|
2
3
|
repositories {
|
|
3
4
|
google()
|
|
4
5
|
mavenCentral()
|
|
5
6
|
}
|
|
6
7
|
dependencies {
|
|
7
8
|
classpath 'com.android.tools.build:gradle:8.0.2'
|
|
9
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
apply plugin: 'com.android.library'
|
|
14
|
+
apply plugin: 'kotlin-android'
|
|
15
|
+
|
|
16
|
+
def isNewArchitectureEnabled() {
|
|
17
|
+
return project.hasProperty("newArchEnabled") && project.getProperty("newArchEnabled") == "true"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (isNewArchitectureEnabled()) {
|
|
21
|
+
apply plugin: "com.facebook.react"
|
|
22
|
+
}
|
|
12
23
|
|
|
13
24
|
android {
|
|
14
25
|
namespace "com.inappinspector"
|
|
@@ -18,7 +29,7 @@ android {
|
|
|
18
29
|
minSdkVersion 21
|
|
19
30
|
targetSdkVersion 34
|
|
20
31
|
versionCode 1
|
|
21
|
-
versionName "1.1.
|
|
32
|
+
versionName "1.1.35"
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
lintOptions {
|
|
@@ -34,4 +45,5 @@ repositories {
|
|
|
34
45
|
dependencies {
|
|
35
46
|
//noinspection GradleDynamicVersion
|
|
36
47
|
implementation 'com.facebook.react:react-native:+'
|
|
48
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
37
49
|
}
|