Back to list
5dlabs

react-native-best-practices

by 5dlabs

Cognitive Task Orchestrator - GitOps on Bare Metal or Cloud for AI Agents

2🍴 1📅 Jan 25, 2026

SKILL.md


name: react-native-best-practices description: React Native performance optimization - FPS, bundle size, TTI, memory management, animations.

React Native Best Practices

Performance optimization guide for React Native applications based on Callstack's "Ultimate Guide to React Native Optimization".

When to Apply

Reference these guidelines when:

  • Debugging slow/janky UI or animations
  • Investigating memory leaks (JS or native)
  • Optimizing app startup time (TTI)
  • Reducing bundle or app size
  • Writing native modules (Turbo Modules)
  • Profiling React Native performance

Priority-Ordered Guidelines

PriorityCategoryImpactPrefix
1FPS & Re-rendersCRITICALjs-*
2Bundle SizeCRITICALbundle-*
3TTI OptimizationHIGHnative-*, bundle-*
4Native PerformanceHIGHnative-*
5Memory ManagementMEDIUM-HIGHjs-*, native-*
6AnimationsMEDIUMjs-*

Quick Reference

Critical: FPS & Re-renders

Profile first:

# Open React Native DevTools
# Press 'j' in Metro, or shake device → "Open DevTools"

Common fixes:

  • Replace ScrollView with FlatList/FlashList for lists
  • Use React Compiler for automatic memoization
  • Use atomic state (Jotai/Zustand) to reduce re-renders
  • Use useDeferredValue for expensive computations

Critical: Bundle Size

Analyze bundle:

npx react-native bundle \
  --entry-file index.js \
  --bundle-output output.js \
  --platform ios \
  --sourcemap-output output.js.map \
  --dev false --minify true

npx source-map-explorer output.js --no-border-checks

Common fixes:

  • Avoid barrel imports (import directly from source)
  • Remove unnecessary Intl polyfills (Hermes has native support)
  • Enable tree shaking (Expo SDK 52+ or Re.Pack)
  • Enable R8 for Android native code shrinking

High: TTI Optimization

Measure TTI:

  • Use react-native-performance for markers
  • Only measure cold starts (exclude warm/hot/prewarm)

Common fixes:

  • Disable JS bundle compression on Android (enables Hermes mmap)
  • Use native navigation (react-native-screens)
  • Defer non-critical work with InteractionManager

High: Native Performance

Profile native:

  • iOS: Xcode Instruments → Time Profiler
  • Android: Android Studio → CPU Profiler

Common fixes:

  • Use background threads for heavy native work
  • Prefer async over sync Turbo Module methods
  • Use C++ for cross-platform performance-critical code

Problem → Solution Mapping

ProblemStart With
App feels slow/jankyMeasure FPS → Profile React
Too many re-rendersProfile React → React Compiler
Slow startup (TTI)Measure TTI → Analyze bundle
Large app sizeAnalyze app → Enable R8
Memory growingCheck JS or native memory leaks
Animation drops framesUse Reanimated worklets
List scroll jankUse FlatList/FlashList
TextInput lagUse uncontrolled components
Native module slowTurbo Modules → Threading

Key Patterns

Use FlashList for Large Lists

// Bad: ScrollView with many items
<ScrollView>
  {items.map(item => <Item key={item.id} {...item} />)}
</ScrollView>

// Good: FlashList with virtualization
import { FlashList } from "@shopify/flash-list";

<FlashList
  data={items}
  renderItem={({ item }) => <Item {...item} />}
  estimatedItemSize={100}
/>

Avoid Barrel Imports

// Bad: imports entire barrel
import { Button, Card, Modal } from '@/components';

// Good: direct imports
import { Button } from '@/components/Button';
import { Card } from '@/components/Card';

Use Reanimated for Smooth Animations

import Animated, { 
  useAnimatedStyle, 
  withSpring 
} from 'react-native-reanimated';

const animatedStyle = useAnimatedStyle(() => ({
  transform: [{ scale: withSpring(pressed.value ? 0.9 : 1) }],
}));

Defer Non-Critical Work

import { InteractionManager } from 'react-native';

useEffect(() => {
  InteractionManager.runAfterInteractions(() => {
    // Expensive work after animations complete
    loadAnalytics();
  });
}, []);

Attribution

Based on "The Ultimate Guide to React Native Optimization" by Callstack - 642+ installs.

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon