Przejdź do głównej zawartości

Expo Development Patterns

Ta treść nie jest jeszcze dostępna w Twoim języku.

Supercharge your Expo development workflow with Cursor IDE and Claude Code. These patterns cover the managed workflow, EAS Build, Expo Router, and the unique advantages of building React Native apps with Expo’s comprehensive toolkit.

  1. Open Cursor in your projects folder
  2. Activate Agent mode (Cmd/Ctrl + I)
  3. Prompt: “Create a new Expo app with:
    • Expo Router for navigation
    • TypeScript configuration
    • NativeWind for styling
    • Expo SDK 50+
    • EAS Build configuration”
  4. Agent will handle the complete setup process
// Cursor prompt for app structure:
"Set up Expo Router with:
- Tab navigation with (tabs) layout
- Stack navigation in each tab
- Modal routes
- Dynamic routes with [id]
- Protected routes with auth check
- Deep linking configuration"
// Generated structure:
app/
(tabs)/
_layout.tsx
index.tsx
profile.tsx
settings.tsx
(auth)/
login.tsx
register.tsx
post/
[id].tsx
modal.tsx
_layout.tsx
// Cursor Agent prompt:
"Create tab layout with:
- Custom tab bar component
- Icon animations
- Badge notifications
- Platform-specific styling"
// Comprehensive styling prompt:
"Configure NativeWind with:
1. Tailwind config for mobile
2. Custom theme colors
3. Dark mode support
4. Platform-specific classes
5. Responsive breakpoints"

Styled Components

// Prompt: "Create styled button with:
// - Multiple variants
// - Press animations
// - Loading states
// - NativeWind classes"

Theme System

// Prompt: "Implement theme with:
// - Color schemes
// - Typography scale
// - Spacing system
// - Component variants"
// Camera implementation prompt:
"Implement camera feature using Expo Camera with:
- Photo and video capture
- Camera switching
- Flash control
- Media library saving
- Permissions handling
- Error states"
  1. Setup: “Configure expo-location with permissions”
  2. Tracking: “Implement real-time location tracking”
  3. Geofencing: “Add region monitoring”
  4. Background: “Set up background location tasks”
// Notification setup prompt:
"Configure push notifications with:
- Expo Notifications setup
- FCM/APNs configuration
- Local notifications
- Notification handlers
- Deep linking from notifications
- Analytics tracking"
// State management prompt:
"Set up Zustand for Expo app with:
- Persistent storage using SecureStore
- Authentication state
- App settings
- Offline data queue
- DevTools integration"
// API state management:
"Configure React Query with:
- Expo SQLite persistence
- Offline support
- Background refetch
- Optimistic updates
- Error boundaries"
// Cursor prompt: "Configure EAS Build for development with:
// - iOS simulator build
// - Android emulator build
// - Development client
// - Environment variables"
// CI/CD setup prompt:
"Create GitHub Actions workflow for:
- Automated EAS builds
- Preview builds on PR
- Production deployment
- OTA update triggers
- Version management"
// Test generation prompt:
"Write tests for Expo components using:
- Jest and React Native Testing Library
- Expo modules mocking
- Navigation testing
- Gesture testing
- Snapshot tests"
  1. Setup: “Configure Maestro for Expo app”
  2. Write Flows: “Create E2E test for onboarding”
  3. CI Integration: “Add Maestro tests to EAS Build”

Performance Patterns

AI can implement:

  • Asset optimization
  • Bundle size reduction
  • Splash screen optimization
  • Memory management
  • FlatList optimizations
// Analytics setup prompt:
"Implement analytics with:
- Expo Analytics
- Custom event tracking
- Performance monitoring
- Crash reporting
- User properties"
// Complete auth prompt:
"Implement authentication using:
- Expo AuthSession
- Social providers (Google, Apple, Facebook)
- Secure token storage
- Biometric authentication
- Session management"
// File handling prompt:
"Create file management system with:
- Document picker
- Image picker with editing
- File upload with progress
- Download management
- Cache control"
  1. Local Database: “Set up Expo SQLite with schema”
  2. Sync Logic: “Implement data synchronization”
  3. Conflict Resolution: “Handle merge conflicts”
  4. Queue Management: “Create offline action queue”
// Advanced routing prompt:
"Implement dynamic routing with:
- Catch-all routes
- Optional parameters
- Route groups
- Layout routes
- API routes"
// Auth guard implementation:
"Create route protection with:
- Authentication checks
- Role-based access
- Redirect logic
- Loading states
- Deep link preservation"
// Module creation prompt:
"Create custom Expo module for:
- Native functionality not in SDK
- iOS and Android implementation
- TypeScript definitions
- Example app
- Documentation"
// Debugging setup:
"Configure debugging environment with:
- React DevTools
- Expo Dev Tools
- Performance monitor
- Network inspector
- Redux DevTools"

Comprehensive Error Strategy

Implement with AI:

  • Error boundaries
  • Sentry integration
  • User feedback forms
  • Recovery mechanisms
  • Debug information collection
// Structure prompts like:
"Create [feature] for Expo using:
- SDK version: [version]
- Platforms: [iOS/Android/Web]
- Key requirements: [list]
- Expo modules needed: [list]
- Include error handling and loading states"

SDK Compatibility

Always mention SDK version and required Expo modules

Managed vs Bare

Specify workflow type for accurate implementations

Platform Differences

Request platform-specific handling when needed

Performance

Ask for Expo-optimized solutions

// Web compatibility prompt:
"Add web support to Expo app with:
- Responsive design
- SEO optimization
- PWA configuration
- Platform-specific components
- Navigation adaptation"
// Monorepo configuration:
"Set up Expo in monorepo with:
- Shared packages
- Multiple apps
- Common components
- Build configuration
- Workspace setup"
  1. Analyze: “Scan existing RN project for compatibility”
  2. Plan: “Create migration strategy”
  3. Migrate: “Convert to Expo managed workflow”
  4. Test: “Verify all features work”