npx skills add ...
npx skills add affaan-m/ecc --skill react-native-patterns
React Native and Expo app patterns — Expo Router navigation, state separation (server/client/route/form), TanStack Query data fetching with Zod, performant lists, NativeWind/StyleSheet styling, native APIs, and secure storage. Use when building or editing React Native / Expo screens, components, navigation, or data layers.
npx skills add affaan-m/ecc --skill react-native-patterns
Practical patterns for building production React Native apps with Expo. Covers navigation, state, data fetching, lists, styling, and native APIs. Pairs with the rules/react-native/ ruleset: rules say what to enforce, this skill shows how.
Libraries named below (NativeWind, Zustand/Jotai, TanStack Query) are common, well-established options shown for illustration — the patterns matter more than the specific package, and any equivalent works. Zod is used for validation to stay consistent with ECC's existing typescript/ rules.
These patterns assume the managed Expo workflow (Expo Router, EAS, expo-* modules) on the New Architecture (the default in recent Expo SDKs, mandatory from SDK 55+). They do NOT assume the browser DOM — React Native has no <div>, no URL bar, and no web data-fetching defaults.
Use this skill when:
app/ directory)Do NOT use the web/React-DOM patterns here — URL-as-state, <div>, and SWR-for-browser do not apply to React Native.
File-based routing under app/. Keep route files thin: they read and validate params, then delegate to a screen component that lives in components/ or features/.
Deep links and dynamic routes deliver untrusted strings. Validate them with Zod before use.
Do not duplicate server data into a client store. Each concern has its own home.
| Concern | Common choices |
|---|---|
| Server state (remote data) | a server-cache library (TanStack Query, SWR) |
| Client/UI state | a lightweight store (Zustand, Jotai) or Context |
| Route/navigation state | Expo Router params |
| Form state | a form library (e.g. React Hook Form) + schema validation |
| Secrets / tokens | expo-secure-store |
| Non-secret persistence | AsyncStorage / MMKV |
Prefer local useState until state genuinely needs sharing.
Use a server-cache library (TanStack Query, SWR) instead of fetch-in-useEffect. Validate at the boundary and infer types from the schema. Handle loading, error, and empty states explicitly. (Example uses TanStack Query.)
Use FlashList (Shopify) for large or heterogeneous lists.
StyleSheet.create() is the framework-native option; utility-class libraries (e.g. NativeWind) are a common alternative. Choose one and stay consistent. Never build style objects inline in JSX on hot paths.
Keep Expo SDK calls and subscriptions inside use* hooks, not in JSX. Always clean up.
use* hooks.renderItem; provide a stable keyExtractor.react-native-reanimated for animation (UI thread); avoid heavy work on the JS thread.expo-secure-store; never trust the client for authorization.frontend-patterns — React/Next.js (web) patterns; useful for shared React concepts, but DOM-specific.coding-standards — TypeScript/JavaScript idioms that apply to RN code.tdd-workflow, e2e-testing — testing process (use Jest + React Native Testing Library, Maestro/Detox for RN).security-review — general security checklist that complements the RN bundle/secret guidance above.