Skip to content

skillMobilereact-native

React Native Performance

Finds and fixes janky lists, wasted re-renders and chatty bridge calls in a React Native app, measuring before and after each change.

npx workspacetemplates add react-native-performance --tool claude-code

Writes 1 file to .claude/skills/react-native-performance/

.claude/skills/react-native-performance/SKILL.md28 lines · 2.1 KBFile
---
name: react-native-performance
description: Finds and fixes janky lists, wasted re-renders and chatty bridge calls in a React Native app, measuring before and after each change.
---

# React Native performance

Measure first. Never optimize on a debug build or in the simulator alone.

## Steps

1. Name the symptom and the screen. Build in release mode (`npx react-native run-android --mode release` or the Xcode Release scheme) and note the baseline: frame rate from the perf monitor, or a React Profiler recording of the interaction.
2. Lists first. For FlatList or SectionList check: a stable `keyExtractor` (never the array index for reorderable data), `getItemLayout` for fixed-height rows, `windowSize` and `maxToRenderPerBatch` tuned down, `removeClippedSubviews` on Android, and row components wrapped in `React.memo` with stable props. Consider FlashList when rows vary and the list is long.
3. Re-renders. Use the Profiler to find components that render without a prop change. Fix the cause: inline objects and arrow functions passed as props, a context whose value changes every render, state kept too high in the tree. Reach for `useMemo` and `useCallback` only where a memoized child receives the value.
4. Bridge and JS thread. Look for loops that call native modules per item, `JSON.parse` of large payloads on the JS thread, and animations that use `setState`. Batch native calls, move animations to Reanimated worklets or `useNativeDriver: true`, and defer heavy work with `InteractionManager.runAfterInteractions`.
5. Images. Require explicit width and height, resize on the server, and use a caching image component.
6. Startup. Check bundle size, Hermes enabled, and imports that run work at module load. Use inline requires for rarely used screens.
7. Re-measure after each single change and keep it only if the number improves.

## Rules

- One change per measurement.
- Do not add `useMemo` everywhere. Unmeasured memoization is noise.
- Never remove accessibility props to save render time.

## Report

Baseline and final numbers, each change kept with file and line, and changes reverted because they did not help.

What it does

React Native apps rarely feel slow for one big reason. A FlatList renders too much, a context update repaints a whole screen, or a loop crosses the native boundary a few hundred times. This skill makes the agent find which of those is real before it rewrites anything.

Every change is tied to a number: dropped frames, render counts or time to interactive on a release build. If a fix does not move the number, it is reverted instead of left behind as clutter.

Example

you › The order history screen janks when I scroll fast on a Pixel 6a. Fix it.

agent › Baseline on a release build: 41 fps while flinging, 118 renders of OrderRow per scroll. Causes: onPress arrow created inline in renderItem, keyExtractor used the index, and each row loaded a 1200px image. Fixed: stable handler via useCallback plus React.memo on OrderRow, keyExtractor uses order.id, thumbnails requested at 160px. Result: 58 fps, 14 renders. Reverted: removeClippedSubviews, no measurable gain.

Questions

Why does it insist on release builds?
Debug builds run unminified JS with extra checks, so timings can be several times worse and point at the wrong culprit. Release numbers match what users feel.
Does it rewrite my state management?
Only when the profiler shows state placement is the cause. It prefers moving state down or splitting a context over adopting a new library.
Does it work with the New Architecture?
Yes. The measuring steps are the same. The bridge advice applies mainly to older native modules, and the skill checks which setup you use first.
  • Flutter State Management

    Skillflutter

    Free
  • Kotlin Android Compose

    Skillkotlin

    Free
  • Mobile App Release

    SkillMobile

    Free
  • Offline First Sync

    SkillMobile

    Free