React Native Core
Shared model for the react-native cluster. UI and interaction spokes depend on these
runtime facts — keep them consistent. For build/ship/Expo specifics, see expo-core.
1. Architecture (know which you're on)
- New Architecture (default on recent RN): Fabric renderer, TurboModules (lazy native modules), JSI (direct JS↔native, no async bridge), bridgeless mode. Enables synchronous calls and better perf.
- Old bridge (legacy): async, serialized JSON bridge — the bottleneck the New Arch removes.
- Most decisions (Reanimated worklets, synchronous measurements) assume the New Architecture.
2. Styling
- StyleSheet + Flexbox is the baseline (Flexbox defaults differ from web:
flexDirection: 'column', no px).
- NativeWind / Tailwind for utility styling across native + web →
expo-tailwind-setup.
- Platform-specific styles via
Platform.select or .ios.tsx / .android.tsx files.
3. Navigation
- React Navigation — the library standard (native-stack, tabs, drawer).
- Expo Router — file-based routing on top of React Navigation →
building-native-ui (expo cluster).
- Pick one per app; don't mix routing paradigms.
4. Animation & gesture stack (the modern default)
- Reanimated — animations run in worklets on the UI thread, so they don't stall when the JS thread is busy. Use
useSharedValue, useAnimatedStyle, withTiming/withSpring.
- Gesture Handler — native-driven gestures that compose with Reanimated.
- Day-to-day usage →
react-native-design; touch/haptics feel → mobile-touch.
- Animate
transform/opacity for 60fps; avoid animating layout. Honor reduce-motion.
5. Platform differences
Platform.OS / Platform.select for runtime branches; .ios.tsx/.android.tsx for whole-file splits.
- Safe areas, status bar, back-button (Android), and haptics differ — design for both.
- Native iOS in SwiftUI/UIKit (not RN) →
native-ios cluster (mobile-ios-design).
6. Performance
- Virtualize long lists —
FlatList / FlashList, never .map() a big array into views.
- Minimize re-renders:
React.memo, stable callbacks, useMemo for heavy derivations.
- Keep work off the JS thread; move animation/gesture to the UI thread (Reanimated).
- Profile with the New Arch tooling / Flipper / DevTools.
7. Data
Network + cache + offline via native-data-fetching (fetch, React Query/SWR). Treat the
server cache (React Query) as separate from UI state.
8. Integrated product-flow audits
Use references/integrated-flow-audit.md when the task asks whether the whole app flow,
role architecture, or UI/UX implementation matches the product/agent contract. The audit
order is:
- Product contract: actors, entry gates, success states, safety/consent, revenue or token rules.
- Route graph: first-run, authenticated, role-specific tabs, modal/deep-link paths, exits.
- State authority: server, local bootstrap, cache, secure storage, fixtures, and reset behavior.
- Data path: screen -> hook/provider -> API -> cache/fallback -> persistence -> recovery UI.
- UI/UX states: empty/loading/error/offline/success/retry/back paths, not just happy paths.
- Verification: static checks, route validators, simulator scripts, live API smoke where relevant.
For Expo Router or EAS evidence, pair this with expo-core / expo-orchestrator.
9. Shared guardrails
- UI-thread animations/gestures (Reanimated worklets + Gesture Handler) — never block JS.
- Transforms over layout for motion; 60fps target; respect reduce-motion.
- Virtualize lists; cut needless re-renders.
- One navigation paradigm per app.
- One authority per product fact: auth identity, role, wallet balance, booking, conversation, consent, and safety state should not have competing production sources.
- Fixture/mock fallbacks must be visibly bounded to demo/simulator/test paths and must not be used as proof that production flow works.
- Toolchain/build/ship →
expo-core; native SwiftUI → native-ios.
1---2name: react-native-core3description: Shared reference for the React Native cluster: the New Architecture (Fabric/TurboModules/JSI/bridgeless), styling approaches, navigation options, the Reanimated + Gesture Handler animation stack, platform differences, performance rules, and integrated product-flow audits. USE WHEN making RN UI/interaction decisions or reviewing whole-app flow gaps. Pairs with expo-core for the toolchain.4---56# React Native Core78Shared model for the `react-native` cluster. UI and interaction spokes depend on these9runtime facts — keep them consistent. For build/ship/Expo specifics, see `expo-core`.1011## 1. Architecture (know which you're on)1213- **New Architecture** (default on recent RN): **Fabric** renderer, **TurboModules** (lazy native modules), **JSI** (direct JS↔native, no async bridge), **bridgeless** mode. Enables synchronous calls and better perf.14- **Old bridge** (legacy): async, serialized JSON bridge — the bottleneck the New Arch removes.15- Most decisions (Reanimated worklets, synchronous measurements) assume the New Architecture.1617## 2. Styling1819- **StyleSheet + Flexbox** is the baseline (Flexbox defaults differ from web: `flexDirection: 'column'`, no `px`).20- **NativeWind / Tailwind** for utility styling across native + web → `expo-tailwind-setup`.21- Platform-specific styles via `Platform.select` or `.ios.tsx` / `.android.tsx` files.2223## 3. Navigation2425- **React Navigation** — the library standard (native-stack, tabs, drawer).26- **Expo Router** — file-based routing on top of React Navigation → `building-native-ui` (expo cluster).27- Pick one per app; don't mix routing paradigms.2829## 4. Animation & gesture stack (the modern default)3031- **Reanimated** — animations run in **worklets on the UI thread**, so they don't stall when the JS thread is busy. Use `useSharedValue`, `useAnimatedStyle`, `withTiming/withSpring`.32- **Gesture Handler** — native-driven gestures that compose with Reanimated.33- Day-to-day usage → `react-native-design`; touch/haptics feel → `mobile-touch`.34- **Animate `transform`/`opacity`** for 60fps; avoid animating layout. Honor reduce-motion.3536## 5. Platform differences3738- `Platform.OS` / `Platform.select` for runtime branches; `.ios.tsx`/`.android.tsx` for whole-file splits.39- Safe areas, status bar, back-button (Android), and haptics differ — design for both.40- Native iOS in **SwiftUI/UIKit** (not RN) → `native-ios` cluster (`mobile-ios-design`).4142## 6. Performance4344- **Virtualize long lists** — `FlatList` / `FlashList`, never `.map()` a big array into views.45- Minimize re-renders: `React.memo`, stable callbacks, `useMemo` for heavy derivations.46- Keep work off the JS thread; move animation/gesture to the UI thread (Reanimated).47- Profile with the New Arch tooling / Flipper / DevTools.4849## 7. Data5051Network + cache + offline via `native-data-fetching` (fetch, React Query/SWR). Treat the52server cache (React Query) as separate from UI state.5354## 8. Integrated product-flow audits5556Use `references/integrated-flow-audit.md` when the task asks whether the whole app flow,57role architecture, or UI/UX implementation matches the product/agent contract. The audit58order is:59601. Product contract: actors, entry gates, success states, safety/consent, revenue or token rules.612. Route graph: first-run, authenticated, role-specific tabs, modal/deep-link paths, exits.623. State authority: server, local bootstrap, cache, secure storage, fixtures, and reset behavior.634. Data path: screen -> hook/provider -> API -> cache/fallback -> persistence -> recovery UI.645. UI/UX states: empty/loading/error/offline/success/retry/back paths, not just happy paths.656. Verification: static checks, route validators, simulator scripts, live API smoke where relevant.6667For Expo Router or EAS evidence, pair this with `expo-core` / `expo-orchestrator`.6869## 9. Shared guardrails7071- UI-thread animations/gestures (Reanimated worklets + Gesture Handler) — never block JS.72- Transforms over layout for motion; 60fps target; respect reduce-motion.73- Virtualize lists; cut needless re-renders.74- One navigation paradigm per app.75- One authority per product fact: auth identity, role, wallet balance, booking, conversation, consent, and safety state should not have competing production sources.76- Fixture/mock fallbacks must be visibly bounded to demo/simulator/test paths and must not be used as proof that production flow works.77- Toolchain/build/ship → `expo-core`; native SwiftUI → `native-ios`.