Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build performant React Native and Expo apps with best practices for lists, animations, and navigation
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/list-performance-images.md
1---2title: Use Compressed Images in Lists3impact: HIGH4impactDescription: faster load times, less memory5tags: lists, images, performance, optimization6---78## Use Compressed Images in Lists910Always load compressed, appropriately-sized images in lists. Full-resolution11images consume excessive memory and cause scroll jank. Request thumbnails from12your server or use an image CDN with resize parameters.1314**Incorrect (full-resolution images):**1516```tsx17function ProductItem({ product }: { product: Product }) {18return (19<View>20{/* 4000x3000 image loaded for a 100x100 thumbnail */}21<Image22source={{ uri: product.imageUrl }}23style={{ width: 100, height: 100 }}24/>25<Text>{product.name}</Text>26</View>27)28}29```3031**Correct (request appropriately-sized image):**3233```tsx34function ProductItem({ product }: { product: Product }) {35// Request a 200x200 image (2x for retina)36const thumbnailUrl = `${product.imageUrl}?w=200&h=200&fit=cover`3738return (39<View>40<Image41source={{ uri: thumbnailUrl }}42style={{ width: 100, height: 100 }}43contentFit='cover'44/>45<Text>{product.name}</Text>46</View>47)48}49```5051Use an optimized image component with built-in caching and placeholder support,52such as `expo-image` or `SolitoImage` (which uses `expo-image` under the hood).53Request images at 2x the display size for retina screens.54