Install the skill above, then run this in your AI tool:
/react-native-patterns <your description>
About
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*.
Source
What gets added to your project
Preview every file this package writes on install before you run the command above.
Summary
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 b...
Skill instructions
React Native / Expo 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.
When to Activate
Use this skill when:
Building or editing React Native / Expo screens, components, or navigation
Setting up routing with Expo Router (file-based app/ directory)
Deciding where state belongs (server cache vs client store vs route params vs form)
Wiring data fetching with TanStack Query and validating responses with Zod
Rendering long or heavy lists
Choosing or applying a styling approach (NativeWind or StyleSheet)
Accessing native device APIs (camera, location, notifications) or secure storage
Reviewing RN code for mobile-specific issues
Do NOT use the web/React-DOM patterns here — URL-as-state, <div>, and SWR-for-browser do not apply to React Native.
Core Concepts
Project structure (Expo Router)
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/.
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.
Data fetching: a cache library + Zod
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.
Styling: pick one system
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.
// WRONG: large array mapped inside a ScrollView (no virtualization, janky, high memory)
<ScrollView>{items.map((i) =><Rowkey={i.id}item={i} />)}</ScrollView>
// RIGHT: FlatList / FlashList// WRONG: server data copied into a client store (two sources of truth, stale data)const useStore = create((set) => ({ users: [], setUsers: (u) =>set({ users: u }) }))
useEffect(() => { getUsers().then(setUsers) }, [])
// RIGHT: useQuery owns server state; derive what you need// WRONG: tokens in AsyncStorage (not encrypted)awaitAsyncStorage.setItem('auth_token', token)
// RIGHT: expo-secure-store// WRONG: trusting deep-link paramsconst { id } = useLocalSearchParams(); fetchUser(id)
// RIGHT: validate with Zod before use// WRONG: inline style object recreated every render on a hot path
<View style={{ padding: 16, backgroundColor: '#fff' }} />
// RIGHT: StyleSheet.create at module scope, or NativeWind className// WRONG: real secret shipped in the bundleconstSTRIPE_SECRET = 'sk_live_...'// RIGHT: keep privileged calls server-side; ship only public keys protected by backend rules
Best Practices
Keep route files thin; put logic in screen components and use* hooks.
Validate every external input (API responses, route params, push payloads) with Zod.
Let TanStack Query own server state; keep client stores small.
Always render loading, error, and empty states — never just a spinner with no fallback.
Virtualize lists; memoize renderItem; provide a stable keyExtractor.
Use react-native-reanimated for animation (UI thread); avoid heavy work on the JS thread.
Store tokens in expo-secure-store; never trust the client for authorization.
Respect safe areas, Dynamic Type, and accessibility roles/labels from the start.
Confirm New Architecture compatibility for every native dependency before release.
Related Skills
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.
Add this badge to a GitHub README so readers can open the package page and install the same version.
[](https://www.aipm-registry.com/skills/affaan-m/react-native-patterns/1.0.0?utm_source=github&utm_medium=readme&utm_campaign=package_badge)
This imported publisher has not claimed its AIPM account. A connected account confirms account control, but it does not guarantee that a package is safe.
AI assistant context
What this skill is for
@affaan-m/react-native-patterns@1.0.0 is an AIPM skill package for All tools. Use it when a project needs the reusable AI behavior described as: 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 b...
Preview a UI component mockup in a local browser canvas where the human directly edits it (move, resize, edit text, delete, restyle), switches mobile/desktop/custom viewports, tests it, chats with you, and clicks Save and Finish. You the...
Run aipm add @affaan-m/react-native-patterns@1.0.0 in a project that has AIPM initialized.
Supported tools
@affaan-m/react-native-patterns@1.0.0 supports All tools.
Before installing
AIPM skills can add files to your project. Review the package name, target, description, license, and publisher before installing. Use a clean branch when trying a new skill.