Skip to content

React Native Development Patterns

Master React Native development with Cursor IDE and Claude Code. These patterns cover cross-platform mobile development, native module integration, performance optimization, and deployment strategies for iOS and Android.

  1. Open Cursor in your workspace
  2. Activate Agent mode (Cmd/Ctrl + I)
  3. Prompt: “Create a new React Native app with TypeScript, React Navigation, React Native Paper UI, and testing setup”
  4. Let the agent handle the CLI commands and initial setup
  5. Review the generated structure and configuration
// Use Cursor's Agent mode for component generation
// Prompt: "Create a reusable Button component with:
// - TypeScript support
// - Multiple variants (primary, secondary, danger)
// - Loading state
// - Accessibility features
// - Platform-specific styling"
// Agent will generate:
import React from 'react';
import {
TouchableOpacity,
Text,
ActivityIndicator,
StyleSheet,
Platform,
TouchableOpacityProps,
} from 'react-native';
interface ButtonProps extends TouchableOpacityProps {
variant?: 'primary' | 'secondary' | 'danger';
loading?: boolean;
children: React.ReactNode;
}
export const Button: React.FC<ButtonProps> = ({
variant = 'primary',
loading = false,
children,
disabled,
style,
...props
}) => {
// Component implementation with platform-specific styling
};
// Cursor Agent Prompt:
"Set up React Navigation with:
- Bottom tab navigator
- Stack navigators for each tab
- Deep linking support
- TypeScript types
- Authentication flow"
// The agent will create a complete navigation structure
  1. Initialize with AI: “Set up Redux Toolkit with TypeScript for React Native”
  2. Generate Slices: “Create a user slice with async thunks for API calls”
  3. Connect Components: “Add Redux hooks to UserProfile component”
  4. Add Persistence: “Implement Redux Persist with AsyncStorage”
// Cursor prompt for lightweight state management:
"Create a Zustand store for:
- User authentication state
- App settings
- Offline queue for API calls
- TypeScript interfaces"
// Cursor Agent can help with platform branching
// Prompt: "Create iOS-specific haptic feedback implementation"
import { Platform, NativeModules } from 'react-native';
const HapticFeedback = Platform.select({
ios: () => NativeModules.HapticFeedback,
android: () => null,
})();
// Cursor prompt for optimized lists:
"Create a performant FlatList with:
- Memo optimization
- getItemLayout implementation
- keyExtractor
- onEndReached pagination
- Empty state handling"

AI-Assisted Image Handling

Let Cursor/Claude implement:

  • Lazy loading strategies
  • Cache management
  • Progressive image loading
  • Memory optimization
// Cursor Agent prompt:
"Write comprehensive tests for Button component using:
- React Native Testing Library
- Jest
- Platform-specific test cases
- Accessibility tests"
  1. Setup: “Configure Detox for React Native project”
  2. Write Tests: “Create E2E test for login flow”
  3. CI Integration: “Add Detox tests to GitHub Actions”
Terminal window
# Claude Code can set up debugging tools
claude "Configure Flipper with:
1. Network plugin for API debugging
2. React DevTools integration
3. AsyncStorage viewer
4. Hermes debugger support"
# Cursor prompt: "Create GitHub Actions workflow for iOS deployment"
# Includes:
# - Certificate management
# - TestFlight upload
# - Version bumping
// Complete auth implementation prompt:
"Implement authentication flow with:
1. Login/Register screens
2. Biometric authentication
3. Token refresh logic
4. Secure storage
5. Deep linking for auth callbacks"
// Cursor Agent can implement:
"Create offline-first architecture with:
- SQLite local database
- Sync queue for API calls
- Conflict resolution
- Background sync
- Network state monitoring"
  1. Setup: “Configure push notifications for iOS and Android”
  2. Permissions: “Implement notification permission flow”
  3. Handlers: “Create notification handlers for foreground/background”
  4. Deep Links: “Add deep linking from notifications”
// Good prompt structure:
"Create a [component type] that:
- Requirement 1 with specific details
- Requirement 2 with constraints
- Follows our existing patterns in [file reference]
- Includes TypeScript types
- Has unit tests"

AI-Powered Code Review

Use Cursor/Claude to:

  • Check accessibility compliance
  • Verify platform-specific handling
  • Optimize bundle size
  • Ensure consistent styling
// Cursor can help create native modules
// Prompt: "Create iOS native module for:
// - Custom camera functionality
// - Objective-C bridge
// - Swift implementation
// - TypeScript definitions"
// Implement performance tracking:
"Add performance monitoring with:
- Component render times
- Navigation transitions
- API response times
- Memory usage alerts
- Crash reporting"