askill
react-native-best-practices

react-native-best-practicesSafety 90Repository

Apply React Native performance patterns for smooth 60fps UIs. Use when building or reviewing React Native / Expo applications.

0 stars
1.2k downloads
Updated 2/22/2026

Package Files

Loading files...
SKILL.md

React Native Best Practices

List Performance (Most Common Issue)

// FlatList with proper optimization
<FlatList
  data={items}
  keyExtractor={item => item.id}
  renderItem={({ item }) => <ItemRow item={item} />}  // memoized component
  getItemLayout={(_, index) => ({ length: 72, offset: 72 * index, index })}
  windowSize={5}
  maxToRenderPerBatch={10}
  initialNumToRender={15}
  removeClippedSubviews={true}
/>

// ScrollView for long lists — avoid (renders ALL items at once)
<ScrollView>{items.map(i => <ItemRow key={i.id} item={i} />)}</ScrollView>

Memoization

// Memoize list item components — prevents re-render on parent update
const ItemRow = memo(({ item }: { item: Item }) => {
  return <View><Text>{item.title}</Text></View>;
});

// Stable callbacks with useCallback
const onPress = useCallback(() => navigate('Detail', { id: item.id }), [item.id]);

Native Driver for Animations

// useNativeDriver: true — runs animation on native thread (60fps)
Animated.timing(opacity, {
  toValue: 1,
  duration: 300,
  useNativeDriver: true,  // ALWAYS for opacity, transform
}).start();

// useNativeDriver: false — JS thread, causes jank — avoid

Image Optimization

// Fast Image for network images with caching
import FastImage from 'react-native-fast-image';
<FastImage
  source={{ uri: url, priority: FastImage.priority.normal }}
  resizeMode={FastImage.resizeMode.cover}
/>

// Cache images in production — avoid re-downloading on scroll

State Management

// Zustand for simple global state
const useStore = create<Store>(set => ({
  user: null,
  setUser: (user) => set({ user }),
}));

// React Query for server state
const { data, isLoading } = useQuery({ queryKey: ['user', id], queryFn: () => fetchUser(id) });

// Heavy Redux setup for simple apps — avoid

Navigation (React Navigation)

// Screen options in navigator, not inside component
<Stack.Screen name="Detail" options={{ headerShown: false }} />

// Navigate with typed params
navigation.navigate('Detail', { id: item.id });

// Avoid inline functions in screenOptions
const screenOptions = useMemo(() => ({ headerShown: false }), []);

Checklist

  • FlatList (not ScrollView) for lists > 20 items
  • keyExtractor returns unique string IDs (not index)
  • getItemLayout set for fixed-height items
  • Animations use useNativeDriver: true
  • List items memoized with memo()
  • Images cached (FastImage or Expo Image)
  • No inline arrow functions in renderItem

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

88/100Analyzed 2/24/2026

High-quality technical skill covering React Native performance optimization with excellent code examples and practical configurations. Well-structured with clear sections on lists, memoization, animations, images, state management, and navigation. Includes actionable checklist. Slightly penalized for deep path nesting suggesting potential internal context, but content itself is broadly reusable.

90
90
85
85
90

Metadata

Licenseunknown
Version-
Updated2/22/2026
PublisherMartinNevlaha

Tags

No tags yet.