Documentation Index
Fetch the complete documentation index at: https://resources.devweekends.com/llms.txt
Use this file to discover all available pages before exploring further.
Module Overview
Estimated Time: 3 hours | Difficulty: Beginner-Intermediate | Prerequisites: Core Components
padding, backgroundColor, and fontSize are familiar — but the similarities are deceiving. React Native uses a JavaScript-based styling system that compiles to native layout primitives (UIKit on iOS, Android Views on Android). There is no cascade, no CSS specificity, and no global stylesheets. Every style is scoped to its component, which eliminates an entire class of bugs but requires different organizational patterns.
This module covers the StyleSheet API, responsive design, and building a comprehensive theming system that scales across your entire application.
What You’ll Learn:
- StyleSheet API deep dive
- Responsive styling techniques
- Dark/light theme implementation
- Design tokens and theming
- Platform-specific styles
- Styled components patterns
StyleSheet Fundamentals
StyleSheet.create is not just a convenience wrapper — it validates your styles at creation time and sends them across the bridge only once (rather than on every render), which improves performance. Think of it as pre-compiling your styles.
Creating Styles
Style Composition
React Native supports composing styles by passing an array. Styles later in the array override earlier ones — like stacking transparency sheets on an overhead projector.StyleSheet.flatten
Design Tokens
Design tokens are the atomic constants of your visual language — named values for colors, spacing, typography, and elevation that are used everywhere instead of raw hex codes and pixel values. They serve the same purpose as variables in a design tool like Figma: change the token once, and the entire app updates. The key insight is to create two layers: primitive tokens (the raw color palette, e.g.,blue-500: '#3b82f6') and semantic tokens (the purpose, e.g., primary: colors.blue[500]). This separation lets you swap themes (light/dark) by remapping semantic tokens without touching primitives.
Token System
Theme System
Theme Definition
Theme Context
Using Theme in Components
Responsive Design
Mobile responsive design is different from web responsive design. On the web, you are dealing with viewport widths from 320px to 2560px+. On mobile, the range is narrower (320pt to about 430pt for phones, up to 1024pt for tablets), but you also have to handle orientation changes, dynamic type sizes, and the notch/Dynamic Island on modern iPhones. The approach: design for a base device (typically iPhone 13/14 at 390pt wide), then scale proportionally for smaller and larger screens.Dimensions Hook
Responsive Styles
Breakpoint-Based Styles
Platform-Specific Styles
iOS and Android have fundamentally different visual conventions. Shadows work differently (iOS usesshadowColor/shadowOffset/shadowOpacity/shadowRadius, Android uses elevation). Default fonts differ. Status bar padding varies. Platform.select lets you handle these differences inline without splitting into separate files.
Styled Components Pattern
Theme Switcher Component
Best Practices
Use StyleSheet.create
Always use StyleSheet.create for performance optimization
Avoid Inline Styles
Minimize inline styles to prevent unnecessary re-renders
Design Tokens
Use design tokens for consistent spacing, colors, and typography
Theme Context
Implement theme context for easy dark/light mode switching
Next Steps
Module 7: Flexbox Mastery
Master Flexbox layout for building complex, responsive UIs