How storybookjs/react-native works
Main Components
a. Core Components:
• Storybook UI Engine
• Story Loader System
• Metro Bundler Integration
• WebSocket Server (for device synchronization)
• Addon System
b. Package Structure:
• Core Package (@storybook/react-native)
• Ondevice Addons
• Controls
• Actions
• Backgrounds
• Notes
• React Native UI Components
• Theming System
[Host React Native App] <---> [Storybook Entry Point] <---> [Story Renderer]
• [Metro Bundler + Storybook Config]
• [Story Loader] <---> [Core Engine] <---> [WebSocket Server]
• [Addon System]
[Controls Addon] --- [Actions Addon] --- [Backgrounds Addon] --- [Notes Addon]
• ______________|__________________|________________/
• [Addon API]
Connection Types
• Double lines: Data flow
Key Elements to Highlight
a. Story Loading Pipeline:
[Story Files] -> [Metro Transformer] -> [Story Registry] -> [UI Renderer]
b. Device Communication:
[Device UI] <---> [WebSocket Server] <---> [Other Devices]
c. Configuration Flow:
[main.ts] -> [Preview Config] -> [Story Config] -> [Addon Config]
Additional Details
Annotations for:
• File paths for key configuration files
• Entry points for different platforms
• Addon registration process
• Story format (CSF) handling
• Metro configuration integration points
Implementation Notes
• Use standard UML or similar notation
• Maintain clear separation of concerns
• Both synchronous and asynchronous flows