| name | react-native |
| description | Cross-platform mobile development with React Native. Trigger: When developing mobile apps, implementing platform features, or optimizing performance. |
| license | Apache 2.0 |
| metadata | {"version":"1.1","type":"framework","skills":["react"],"dependencies":{"react-native":">=0.70.0 <1.0.0","react":">=17.0.0 <19.0.0"}} |
React Native
Cross-platform iOS/Android with React Native. Native components, platform code, navigation, and performance.
When to Use
- Cross-platform mobile (iOS + Android)
- Bare React Native (not Expo managed)
- Platform-specific features and native module integration
- Mobile performance optimization
Don't use for:
- Web apps (use react skill)
- Expo-managed (use expo skill)
- Native iOS/Android development only
Critical Patterns
โ
REQUIRED: Use FlatList for Lists
<FlatList
data={items}
keyExtractor={(item) => item.id}
renderItem={({ item }) => <Item data={item} />}
/>
<ScrollView>
{items.map(item => <Item key={item.id} data={item} />)}
</ScrollView>
โ
REQUIRED: Use Platform-Specific Code
import { Platform } from "react-native";
const styles = StyleSheet.create({
container: {
padding: Platform.select({ ios: 10, android: 8 }),
},
});
โ
REQUIRED: Handle Safe Areas
import { SafeAreaView } from 'react-native-safe-area-context';
<SafeAreaView>
<App />
</SafeAreaView>
<View>
<App />
</View>
โ
REQUIRED: Optimize Images
<Image
source={{ uri: url }}
style={{ width: 200, height: 200 }}
resizeMode="cover"
/>
<Image source={{ uri: url }} />
Conventions
React Native Specific
- Platform-specific code when needed
- FlatList virtualization
- Proper safe area handling
- Image/asset optimization
- Hermes engine for performance
- Apply accessibility best practices: accessibilityLabel, accessibilityRole, screen reader support
Decision Tree
Long list?
โ FlatList with keyExtractor and getItemLayout โ see performance-rn.md for FlatList optimization
Platform-specific styling?
โ Platform.select() or Platform.OS === 'ios' โ see platform-specific.md for platform patterns
Navigation?
โ React Navigation library โ see navigation-patterns.md for Stack/Tab/Drawer setup
Gestures/Animations?
โ Gesture Handler + Reanimated โ see gestures-animations.md for gesture and animation patterns
Forms?
โ Controlled components; consider react-hook-form for complex forms
State management?
โ Context for simple, Redux/Zustand for complex
Native feature needed?
โ Check if React Native API exists, otherwise use native module or library โ see native-modules.md for native integration
Performance issue?
โ Enable Hermes, use React.memo(), avoid inline functions in renders, profile with Flipper โ see performance-rn.md for optimization strategies
Testing?
โ Jest + React Native Testing Library, test on real devices
Example
import { View, Text, FlatList, Platform } from 'react-native';
const MyList = ({ items }) => (
<FlatList
data={items}
keyExtractor={(item) => item.id}
renderItem={({ item }) => (
<View style={{ padding: Platform.OS === 'ios' ? 10 : 8 }}>
<Text>{item.name}</Text>
</View>
)}
/>
);
Advanced Architecture Integration
โ ๏ธ Context Check: Same as React. Mobile apps with business logic benefit.
When to Apply
- AGENTS.md specifies architecture (Clean/SOLID/DDD)
- Enterprise apps (banking, healthcare, fintech, ERP)
- Complex logic (auth, payments, offline sync)
- Large teams (>10 devs)
When NOT to Apply
- Simple apps (content, basic forms)
- Prototypes/MVPs
- No AGENTS.md mention
Architecture Integration
React Native uses same patterns as React:
- SOLID Principles โ Service classes, custom hooks, components
- Clean Architecture โ
domain/, application/, infrastructure/, mobile/ (presentation)
- Result Pattern โ Async operations, API calls, local storage
- DIP โ Abstract services (API, storage, permissions) with adapters
Mobile-specific architecture:
export class User {
constructor(
public readonly id: string,
public readonly email: string
) {}
}
export class SecureStorageService implements IStorageService {
async save(key: string, value: string): Promise<Result<void>> {
try {
await SecureStore.setItemAsync(key, value);
return Result.ok(undefined);
} catch (error) {
return Result.fail('Storage error');
}
}
}
const LoginScreen = () => {
const { execute, result } = useLoginUser();
(
);
};
Complete Guide
See frontend-integration.md - same patterns as React.
See architecture-patterns SKILL.md for selection.
Edge Cases
Keyboard: Use KeyboardAvoidingView or keyboard-aware scroll.
Android back: Handle with BackHandler, especially modals.
Permissions: Request runtime (Android 6+), handle denial.
Deep linking: Configure URL schemes (iOS/Android), handle app states.
Offline: Use NetInfo, queue operations offline.
Bundle size: Hermes, ProGuard (Android), Metro analysis.
Debugging: Flipper (network/Redux), React DevTools, Chrome.
Resources