Cross-platform mobile development with React Native. Trigger: When developing mobile apps, implementing platform features, or optimizing performance.
Cross-platform iOS/Android with React Native. Native components, platform code, navigation, and performance.
Don't use for:
// ✅ CORRECT: Virtualized list
<FlatList
data={items}
keyExtractor={(item) => item.id}
renderItem={({ item }) => <Item data={item} />}
/>
// ❌ WRONG: ScrollView with map (memory issues)
<ScrollView>
{items.map(item => <Item key={item.id} data={item} />)}
</ScrollView>
// ✅ CORRECT: Platform.select or Platform.OS
import { Platform } from "react-native";
const styles = StyleSheet.create({
container: {
padding: Platform.select({ ios: 10, android: 8 }),
},
});
// Or separate files: Component.ios.tsx, Component.android.tsx
// ✅ CORRECT: SafeAreaView
import { SafeAreaView } from 'react-native-safe-area-context';
<SafeAreaView>
<App />
</SafeAreaView>
// ❌ WRONG: No safe area handling (notch issues)
<View>
<App />
</View>
// ✅ CORRECT: Specify dimensions, use FastImage for remote images
<Image
source={{ uri: url }}
style={{ width: 200, height: 200 }}
resizeMode="cover"
/>
// ❌ WRONG: No dimensions (layout thrashing)
<Image source={{ uri: url }} />
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
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>
)}
/>
);
⚠️ Context Check: Same as React. Mobile apps with business logic benefit.
React Native uses same patterns as React:
domain/, application/, infrastructure/, mobile/ (presentation)Mobile-specific architecture:
// domain/entities/User.ts (same as web)
export class User {
constructor(
public readonly id: string,
public readonly email: string
) {}
}
// infrastructure/services/SecureStorageService.ts (mobile adapter)
export class SecureStorageService implements IStorageService {
async save(key: string, value: string): Promise<Result<void>> {
try {
await SecureStore.setItemAsync(key, value); // Expo SecureStore
return Result.ok(undefined);
} catch (error) {
return Result.fail('Storage error');
}
}
}
// mobile/screens/LoginScreen.tsx (presentation)
const LoginScreen = () => {
const { execute, result } = useLoginUser(); // Clean Architecture use case
return (
<View>
<TextInput onChangeText={setEmail} />
<Button onPress={() => execute(email, password)} title="Login" />
{result && !result.isSuccess && <Text>{result.error}</Text>}
</View>
);
};
See frontend-integration.md - same patterns as React.
See architecture-patterns SKILL.md for selection.
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.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer