Documentation Index
Fetch the complete documentation index at: https://mintlify.com/satsigner/satsigner/llms.txt
Use this file to discover all available pages before exploring further.
Overview
SatSigner integrates Storybook for React Native, enabling isolated component development, visual testing, and interactive documentation. Storybook runs directly in the mobile app, allowing you to develop and test components on real devices and simulators.What is Storybook?
Storybook is a development environment for UI components. It allows you to:- Develop components in isolation from the main app
- Visualize different component states without complex navigation
- Test components interactively with on-device controls
- Document components with examples and usage notes
- Speed up development by focusing on one component at a time
Installation
Storybook dependencies are included in the project. From the repository root:Storybook Configuration
Main Configuration
Configuration is located inapps/mobile/.storybook/main.ts:
Story Location
Stories are automatically discovered in:apps/mobile/components/**/*.stories.tsapps/mobile/components/**/*.stories.tsxapps/mobile/components/**/*.stories.jsapps/mobile/components/**/*.stories.jsx
Available Addons
Storybook includes four on-device addons:1. Controls Addon
Interactively edit component props in real-time:- Adjust numbers with sliders
- Toggle booleans
- Edit text inputs
- Select from options
2. Actions Addon
Log and inspect component event handlers:- See when callbacks fire
- View event payloads
- Debug user interactions
3. Backgrounds Addon
Test components against different backgrounds:- Light/dark themes
- Custom colors
- Transparent backgrounds
4. Notes Addon
Add markdown documentation to stories:- Usage instructions
- Design guidelines
- Component specifications
Preview Configuration
Global story settings inapps/mobile/.storybook/preview.tsx:
Storage Configuration
Storybook state persists using AsyncStorage (apps/mobile/.storybook/index.tsx):
- Selected story
- Addon panel state
- Control values
Running Storybook
Android
Build and run with Storybook enabled:EXPO_PUBLIC_STORYBOOK_ENABLED=true and launches the app with Storybook UI.
iOS
Build and run with Storybook enabled:Alternative: Environment Variable
Manually enable Storybook:Switching Between App and Storybook
Storybook mode is controlled by theEXPO_PUBLIC_STORYBOOK_ENABLED environment variable:
- Enabled: App shows Storybook UI
- Disabled/Unset: App runs normally
Writing Stories
Basic Story Structure
Create a file next to your component:MyButton.stories.tsx
Story Naming Convention
- File:
ComponentName.stories.tsxnext to component file - Title: Use
/for categories:'Components/Button','Forms/Input' - Exports: Each named export is a story variant
Control Types
Available control types for props:Adding Documentation
Include notes with your stories:Development Workflow
Typical Workflow
- Create component file:
components/MyComponent.tsx - Create story file:
components/MyComponent.stories.tsx - Run Storybook:
yarn sb:iosoryarn sb:android - Develop in isolation:
- View component in Storybook
- Adjust props with controls
- Test different states
- Add more story variants
- Generate stories:
yarn storybook-generate(updates story index) - Integrate into app: Use component in actual screens
Story Generation
After adding or modifying stories, regenerate the story index:sb-rn-get-stories) scans for story files and updates the Storybook registry.
Hot Reloading
Changes to components and stories hot reload automatically:- Edit component code
- Save file
- Storybook refreshes immediately
- No need to rebuild
Best Practices
1. One Component Per Story File
Each component should have its own.stories.tsx file:
2. Cover All States
Create stories for every important state:3. Use Descriptive Titles
Organize stories with clear hierarchies:4. Document Complex Props
Add descriptions to argTypes:5. Mock Dependencies
Isolate components by mocking external dependencies:Troubleshooting
Storybook Won’t Launch
Verify environment variable is set:sb:android or sb:ios scripts.
Stories Not Appearing
Regenerate story index:main.ts:
- Located in
components/directory - Named
*.stories.tsxor*.stories.ts
Controls Not Working
Ensure controls addon is configured:- Check
addonsarray in.storybook/main.ts - Verify
@storybook/addon-ondevice-controlsis listed - Check argTypes are properly defined
App Crashes in Storybook Mode
Component may depend on app context:-
Wrap story in required providers:
- Mock required contexts or services
Changes Not Reflecting
- Clear Metro cache:
yarn start --reset-cache - Regenerate stories:
yarn storybook-generate - Rebuild app:
yarn sb:androidoryarn sb:ios
Available Scripts
Fromapps/mobile/package.json:
Dependencies
Storybook packages indevDependencies:
Next Steps
- Build for Android - Android build setup
- Build for iOS - iOS build setup
- Contributing - Contribution guidelines
- Component Development - Component architecture