Question

React Native list scrolls at 20 fps after Claude Code 'optimized' it

Solved · 11 views · asked by ben_mobile · edited

It added useMemo and useCallback everywhere. Scrolling got worse.

What I’ve tried

Removed some of the memos and callbacks again. Marginal difference, still stutters on scroll.

Comment

1 answer

Marked as helpful by the asker
ben_mobile · edited

Memoization has a cost; sprinkling it everywhere is not optimization. What actually fixes list scrolling:

  1. FlatList with getItemLayout if rows have a fixed height.
  2. Row component wrapped in React.memo with a stable keyExtractor.
  3. No inline arrow functions passed to rows (onPress={() => ...} recreates per render).
  4. Images with explicit width/height.

Measure with the Perf Monitor before and after each one. Ask Claude Code for one change at a time, with the fps number as the acceptance test.

Comment