Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add DonggangChen/antigravity-agentic-skills --skill "mobile_react_native"
Install specific skill from multi-skill repository
# Description
React Native best practices, hooks, navigation and performance optimization.
# SKILL.md
name: mobile_react_native
router_kit: FullStackKit
description: React Native best practices, hooks, navigation and performance optimization.
metadata:
skillport:
category: development
tags: [accessibility, api integration, backend, browser apis, client-side, components, css3, debugging, deployment, frameworks, frontend, fullstack, html5, javascript, libraries, mobile react native, node.js, npm, performance optimization, responsive design, seo, state management, testing, typescript, ui/ux, web development] - mobile-flutter
📱 Mobile React Native
React Native best practices and performance optimization.
📁 1. Project Structure
src/
├── components/
│ ├── common/ # Reusable
│ └── screens/ # Screen components
├── hooks/ # Custom hooks
├── services/ # API, storage
├── store/ # State (Zustand)
├── navigation/
└── App.tsx
⚡ 2. Performance
// FlatList optimization
<FlatList
data={items}
keyExtractor={(item) => item.id}
removeClippedSubviews={true}
maxToRenderPerBatch={10}
windowSize={5}
getItemLayout={(data, index) => ({
length: ITEM_HEIGHT,
offset: ITEM_HEIGHT * index,
index,
})}
/>
// Memoization
const Component = React.memo(({ data }) => { });
const callback = useCallback(() => {}, [deps]);
const value = useMemo(() => compute(), [deps]);
🔐 3. Secure Storage
// ❌ AsyncStorage is not secure
// ✅ Use SecureStore
import * as SecureStore from 'expo-secure-store';
await SecureStore.setItemAsync('token', userToken);
const token = await SecureStore.getItemAsync('token');
🧭 4. Navigation
type RootStackParamList = {
Home: undefined;
Profile: { userId: string };
};
const Stack = createNativeStackNavigator<RootStackParamList>();
📦 5. State (Zustand)
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
const useAuthStore = create(
persist(
(set) => ({
user: null,
login: (user) => set({ user }),
logout: () => set({ user: null }),
}),
{ name: 'auth-storage' }
)
);
📱 6. Platform-Specific
import { Platform } from 'react-native';
const padding = Platform.select({ ios: 20, android: 0 });
// File based: Button.ios.tsx, Button.android.tsx
Mobile React Native v1.1 - Enhanced
🔄 Workflow
Source: React Native Performance Guide & Expo Guideline
Phase 1: Setup & Architecture
- [ ] Framework: Start with Expo (Managed Workflow), use
expo-routerv3. - [ ] State: Separate server/client state using Zustand or TanStack Query.
- [ ] Styling: Establish consistent design system with NativeWind (Tailwind) or Restyle.
Phase 2: Performance Optimization
- [ ] Lists: Use
FlashList(Shopify) instead ofFlatList(5x performance). - [ ] Images: Add caching and blurhash support with
expo-image. - [ ] Bundle: Activate
Hermesengine and analyze bundle size.
Phase 3: Native Modules & Release
- [ ] Native: Write Custom Native Module (Turbo Modules) if needed.
- [ ] Updates: Perform OTA (Over-the-Air) updates with
expo-updateswithout waiting for store approval. - [ ] Profiling: Check FPS and Memory Leak with Flipper or React DevTools.
Checkpoints
| Phase | Verification |
|---|---|
| 1 | Does UI thread (JS thread) drop below 60fps? |
| 2 | Is application size (APK/IPA) optimized? |
| 3 | Are Android and iOS behaviors (Navigation, Keyboard) consistent? |
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.