zereight-react-native-optimizer
zereight-react-native-optimizer
Focused on performance correctness during code review. The goal is not to teach optimization โ it is to catch regressions before they ship.
When to use
Use alongside zereight-review when:
- Reviewing React Native or Expo PRs
- Auditing list, animation, or native module changes
- Checking screen transitions or gesture interactions
Not a replacement for react-native-best-practices or vercel-react-native-skills โ those explain how to optimize. This skill detects what went wrong in a diff.
Prerequisites
The following skills provide the full optimization context this skill references:
react-native-best-practices(callstackincubator)vercel-react-native-skills(vercel-labs)react-native-animations(pluginagentmarketplace)react-native-best-practices(callstackincubator)agent-device(callstackincubator)
Priority order
- Animation on JS thread (causes visible jank โ always ๐ Major or higher)
- List rendering with FlatList instead of FlashList for large datasets
- Unnecessary re-renders in hot paths (list items, animated components)
- Memory leaks (listeners, subscriptions not cleaned up)
- Bridge overuse (synchronous calls, large payloads)
- Bundle size regressions
- Image loading / caching issues
Rendering checks
Run on every component change. See references/rendering.md for detail.
| Pattern | Severity |
|---|---|
| FlatList used for list with 50+ items | ๐ ๏ธ ๐ Major |
keyExtractor returns index |
โ ๏ธ ๐ก Minor |
| Inline function/object passed as prop to memoized child | ๐ ๏ธ ๐ก Minor |
React.memo wrapping component that receives new object ref each render |
โ ๏ธ ๐ก Minor |
| Context provider too high โ causes full subtree re-render | โ ๏ธ ๐ Major |
useSelector selecting large slice of store |
๐ ๏ธ ๐ต Trivial |
Missing useCallback on event handler passed to child |
๐ ๏ธ ๐ต Trivial |
StyleSheet defined inside component body |
๐ ๏ธ ๐ก Minor |
Animation checks
Run when animation, gesture, or transition code is changed. See references/animation.md for detail.
| Pattern | Severity |
|---|---|
Animated.Value (legacy API) used instead of Reanimated shared value |
๐ ๏ธ ๐ Major |
Animation drives style via setState (runs on JS thread) |
โ ๏ธ ๐ Major |
Worklet function accesses JS-side state directly (no runOnJS) |
โ ๏ธ ๐ Major |
useAnimatedStyle depends on non-shared-value reactive data |
โ ๏ธ ๐ก Minor |
Touch handled with TouchableOpacity instead of GestureDetector in animated context |
๐ ๏ธ ๐ก Minor |
LayoutAnimation used instead of Reanimated layout animations |
๐ ๏ธ ๐ต Trivial |
| Animation not cancelled on unmount | โ ๏ธ ๐ก Minor |
Native / bridge checks
Run when native modules, images, or bundle changes are involved. See references/native.md for detail.
| Pattern | Severity |
|---|---|
| Event listener / subscription not removed in cleanup | โ ๏ธ ๐ Major |
NativeModules called synchronously in render path |
โ ๏ธ ๐ Major |
| Large object passed over bridge (>10KB) | โ ๏ธ ๐ก Minor |
Image loaded without resizeMode or explicit width/height |
๐ ๏ธ ๐ก Minor |
| Image source is remote URL without caching strategy | ๐ ๏ธ ๐ก Minor |
| New dependency added without checking bundle size impact | โช Info |
console.log left in production code path |
๐งน ๐ต Trivial |
Findings format
Use the same format as zereight-review:
### [type] [severity] Title
**Condition:** <what triggers this>
**Impact:** <FPS drop / memory leak / jank / crash>
**Evidence:** `file:line` โ short snippet
**Minimal fix:** <smallest safe change>
Output template
When running as standalone review:
Performance Summary(2-3 lines: what changed, overall signal)โ ๏ธ Performance Findings(ordered ๐ โ๐กโ๐ต)๐ฏ Verdict(No regressions|Minor regressions|Block โ performance regression)
When integrated with zereight-review, append findings to the existing โ ๏ธ Findings section under a --- Performance --- subheader.
Quick heuristics
- If it touches a list โ check FlashList, keyExtractor, and item memoization
- If it touches animation โ verify UI thread execution (Reanimated, not setState)
- If it mounts/unmounts โ verify all listeners/subscriptions have cleanup
- If it adds a native module call โ verify async, not in render, not in hot loop
- If it adds a new package โ note bundle size concern as โช Info