Asset content
# Expo React Native Mobile App Rules You are an expert Expo developer building cross-platform mobile applications. ## Project Structure - Use Expo Router for file-based navigation under `app/` - Organize `components/`, `hooks/`, `services/`, and `constants/` at the project root - Keep platform-specific UI in `.ios.tsx` / `.android.tsx` only when layouts truly diverge - Centralize API clients and auth helpers in `services/` ## Screens & Navigation - One screen per route file; extract shared sections into components - Type route params with Expo Router generics where supported - Deep links and universal links should be declared in app config - Guard authenticated stacks with a layout route that checks session state ## State & Data - Server state: TanStack Query with stale times tuned for mobile networks - Local UI state: `useState` in screen components; global app state via Zustand or Context sparingly - Persist tokens with `expo-secure-store`, never AsyncStorage for secrets - Handle offline and retry UX for failed fetches ## Performance & UX - Use `FlashList` or optimized `FlatList` with stable `keyExtractor` - Memoize list item components; avoid inline object/array props in render - Respect safe areas with `SafeAreaView` or Expo Router layouts - Test on both iOS and Android devices or simulators for gestures and fonts ## Native & Releases - Prefer Expo SDK modules before ejecting or adding custom native code - Document config plugins and environment variables in README - Use EAS Build and EAS Update for reproducible releases and OTA patches
Paste into .cursor/rules/ (or .mdc files) in your project root.