d48cda4081
CI / Test (ubuntu-latest, Node 18.x, bun) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, npm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, pnpm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, yarn) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 20.x, bun) (push) Failing after 17m13s
CI / Test (ubuntu-latest, Node 20.x, npm) (push) Failing after 18m42s
CI / Test (ubuntu-latest, Node 20.x, pnpm) (push) Failing after 15m0s
CI / Test (ubuntu-latest, Node 20.x, yarn) (push) Failing after 49m44s
CI / Test (ubuntu-latest, Node 22.x, bun) (push) Failing after 51m55s
CI / Test (ubuntu-latest, Node 22.x, pnpm) (push) Failing after 21m57s
CI / Test (ubuntu-latest, Node 22.x, npm) (push) Failing after 37m39s
CI / Test (ubuntu-latest, Node 22.x, yarn) (push) Failing after 34m7s
CI / Validate Components (push) Failing after 37m15s
CI / Python Tests (push) Failing after 10m1s
CI / Security Scan (push) Failing after 10m1s
CI / Lint (push) Failing after 17m12s
CI / Coverage (push) Failing after 20m19s
CI / Test (macos-latest, Node 18.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, yarn) (push) Has been cancelled
46 lines
2.3 KiB
Markdown
46 lines
2.3 KiB
Markdown
---
|
||
paths:
|
||
- "**/*.ts"
|
||
- "**/*.tsx"
|
||
---
|
||
# React Native / Expo Performance
|
||
|
||
> This file extends [common/performance.md](../common/performance.md) with React Native / Expo specific content.
|
||
|
||
## Rendering
|
||
|
||
- Memoize expensive components with `React.memo`; memoize callbacks/values passed to children with `useCallback`/`useMemo` only where they prevent real re-renders.
|
||
- Keep component state local and narrow — lifting state too high re-renders large subtrees.
|
||
- Avoid creating new objects/arrays/functions inline in props on hot paths; they break memoization.
|
||
- Split large screens so a state change re-renders the smallest possible subtree.
|
||
|
||
## Lists
|
||
|
||
- Use `FlatList`/`SectionList`, or `FlashList` (Shopify) for large or heterogeneous lists.
|
||
- Provide `keyExtractor`, a memoized `renderItem`, and stable item heights when possible (`getItemLayout`).
|
||
- Tune `initialNumToRender`, `windowSize`, `maxToRenderPerBatch` for heavy rows.
|
||
- Never render large data sets with `.map()` inside a `ScrollView`.
|
||
|
||
## Images & Assets
|
||
|
||
- Use `expo-image` for caching, priority, and placeholders; serve appropriately sized images.
|
||
- Avoid loading full-resolution images into small thumbnails.
|
||
|
||
## Animations
|
||
|
||
- Prefer `react-native-reanimated` (runs on the UI thread) over the JS-driven `Animated` API.
|
||
- For legacy `Animated`, set `useNativeDriver: true` where supported.
|
||
- Keep heavy computation off the JS thread; offload to Reanimated worklets or native modules.
|
||
|
||
## Runtime & Build
|
||
|
||
- Build on the **New Architecture** (Fabric + TurboModules). It is the default in recent Expo SDKs (opt-out still available on SDK 53–54) and is mandatory — cannot be disabled — from SDK 55+. Verify every native dependency is New-Arch compatible before shipping.
|
||
- Ensure **Hermes** is enabled (default in modern Expo) for faster startup and lower memory.
|
||
- Defer non-critical work after first paint; lazy-load heavy screens/modules.
|
||
- Use `InteractionManager.runAfterInteractions` for work that can wait until animations finish.
|
||
|
||
## Measuring
|
||
|
||
- Profile with the React DevTools profiler, the Hermes sampling profiler, and the in-app performance monitor. (Avoid Flipper — it is deprecated and not supported on the New Architecture.)
|
||
- Watch for: long lists without virtualization, oversized images, frequent full-tree re-renders, and synchronous work on the JS thread.
|