React Native API Debugger - Development Guide
A comprehensive network request debugging SDK for React Native applications. Intercepts and visualizes HTTP requests with a draggable overlay interface.
src/
├── index.tsx # Public API exports
├── types.ts # TypeScript interfaces and types
├── NetworkInterceptor.ts # Core request interception engine
├── NetworkLoggerOverlay.tsx # Main overlay container component
├── NetworkLogItem.tsx # Individual log entry component
├── FloatingButton.tsx # Draggable trigger button
├── NonFloatingButton.tsx # Static trigger button fallback
├── CopyItem.tsx # Clipboard copy component
├── Icon.tsx # Emoji-based icon component
├── components/ # Reusable UI components (new)
│ ├── index.ts # Component exports
│ ├── Badge.tsx # Status badge component
│ ├── FilterChip.tsx # Filter tag component
│ ├── SearchInput.tsx # Search input component
│ └── JsonViewer.tsx # JSON tree viewer component
├── hooks/ # Custom React hooks (new)
│ ├── index.ts # Hook exports
│ ├── useNetworkLogs.ts # Log subscription hook
│ └── useFilteredLogs.ts # Log filtering hook
├── utils/ # Utility functions (new)
│ ├── index.ts # Utility exports
│ ├── formatters.ts # Data formatting utilities
│ ├── curl.ts # cURL generation
│ └── filters.ts # Filter logic
└── constants/ # Constants and config (new)
├── index.ts # Constants exports
├── colors.ts # Color palette
└── config.ts # Default configuration
Single Responsibility : Each component handles one concern
Composition over Inheritance : Build complex UIs from simple pieces
Graceful Degradation : Features work without optional dependencies
Zero Config Defaults : Works out of the box with sensible defaults
TypeScript First : Full type safety with exported interfaces
Category
Purpose
Examples
Core
Business logic & interception
NetworkInterceptor
Container
State management & data flow
NetworkLoggerOverlay
Presentational
Pure UI rendering
NetworkLogItem, Badge, FilterChip
Interactive
User interaction handling
FloatingButton, CopyItem
Utility
Shared functionality
Icon, JsonViewer
Reusable Component Guidelines
// Component Template
interface ComponentProps {
// Required props first
requiredProp : string ;
// Optional props with defaults
optionalProp ?: boolean ;
// Style overrides last
style ?: StyleProp < ViewStyle > ;
}
const Component : React . FC < ComponentProps > = ( {
requiredProp,
optionalProp = false ,
style,
} ) => {
// Implementation
} ;
Local State : React useState for component-specific state
Shared State : Pub/sub pattern via NetworkLogger.subscribe()
No External Dependencies : No Redux/MobX required
Use StyleSheet.create() for all styles
Define styles at bottom of component file
Use semantic color names from constants/colors.ts
Support both light and dark themes
NetworkLogger Config Interface
interface NetworkLoggerConfig {
maxLogs : number ; // Default: 100
ignoredUrls : string [ ] ; // URL patterns to ignore
ignoredDomains : string [ ] ; // Domains to ignore
redactHeaders : string [ ] ; // Headers to mask (e.g., 'Authorization')
enablePersistence : boolean ; // Persist logs across sessions
slowRequestThreshold : number ; // ms threshold for slow request warning
}
interface NetworkLoggerOverlayProps {
networkLogger : NetworkLogger ;
// Feature flags
draggable ?: boolean ;
enableDeviceShake ?: boolean ;
useCopyToClipboard ?: boolean ;
// Display options
showRequestHeader ?: boolean ;
showResponseHeader ?: boolean ;
theme ?: 'light' | 'dark' | 'auto' ;
// Filtering
defaultFilters ?: FilterConfig ;
}
# Install dependencies
yarn install
# Run example app
yarn example start
# Type checking
yarn typecheck
# Linting
yarn lint
# Run tests
yarn test
# Build library
yarn prepare
# Release
yarn release
Create feature branch from main
Add types to types.ts
Implement in appropriate directory (components/hooks/utils)
Export from index files
Add example usage in example/src/
Update README if public API changes
Write tests for new functionality
Unit tests for utility functions
Component tests for UI components
Integration tests for interceptor logic
Manual testing via example app
Optional Peer Dependencies
Package
Required For
react-native-gesture-handler
Draggable floating button
react-native-reanimated
Smooth animations
react-native-shake
Device shake detection
@react-native-clipboard/clipboard
Copy to clipboard
Use TypeScript strict mode
Prefer functional components with hooks
Use explicit return types on functions
Document public APIs with JSDoc
Follow React Native community conventions
Limit stored logs (default: 100)
Use FlatList with optimization props
Lazy load optional dependencies
Avoid re-renders with React.memo where appropriate
Use useCallback for event handlers passed as props