Production-Ready Rule
•
app/**/*.{tsx,ts}, components/**/*.{tsx,ts}
React Native & Expo Router SDK 52 .cursorrules (.mdc)
Production-ready .cursorrules and .cursor/rules/*.mdc configuration for React Native and Expo Router SDK 52. Enforce typed routing, NativeWind styling, performance list optimization, and smooth 60fps UI.
.cursor/rules/react-native-expo.mdc
---
description: React Native and Expo Router SDK 52 mobile application standards
globs: app/**/*.{tsx,ts}, components/**/*.{tsx,ts}
alwaysApply: false
---
# React Native & Expo Standards
## Expo Router & File Navigation
- Follow file-based routing in the app/ directory strictly. Use _layout.tsx for Stack and Tabs navigation.
- Use typed navigation via `useRouter()` and `router.push({ pathname, params })`.
- Always configure screen options in _layout.tsx rather than imperatively inside individual screen components.
## Performance & 60fps Rendering
- Use `@shopify/flash-list` instead of legacy FlatList for rendering feeds with more than 20 items.
- Memoize list renderItem functions with useCallback and wrap items in React.memo with strict comparison.
- Ensure all images use `expo-image` with cachePolicy="memory-disk" for instant image loads.
## Safe Areas & Cross-Platform Styling
- Always wrap screen views in `SafeAreaView` from `react-native-safe-area-context`.
- When using NativeWind / Tailwind CSS, ensure class strings are mobile-optimized without desktop media queries.
- Support both iOS and Android keyboard dismiss behaviors with `KeyboardAvoidingView` behavior="padding".
⭐
Using this rule in your open-source project? Reference in your README:
https://cursor.pacebowl.com/rules/react-native-expo
Frequently Asked Questions & Implementation Notes
Why does it prefer FlashList over FlatList?
Shopify FlashList recycles native views across scrolling rather than reallocating memory, preventing frame drops and OOM crashes on lower-end Android devices.
Does it support Expo Router SDK 52 typed routes?
Yes, it mandates using typed hrefs and parameters in Expo Router, eliminating broken screen transitions and missing navigation parameters.