Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
67 lines
1.6 KiB
Markdown
67 lines
1.6 KiB
Markdown
---
|
|
title: Use expo-image for Optimized Images
|
|
impact: HIGH
|
|
impactDescription: memory efficiency, caching, blurhash placeholders, progressive loading
|
|
tags: images, performance, expo-image, ui
|
|
---
|
|
|
|
## Use expo-image for Optimized Images
|
|
|
|
Use `expo-image` instead of React Native's `Image`. It provides memory-efficient caching, blurhash placeholders, progressive loading, and better performance for lists.
|
|
|
|
**Incorrect (React Native Image):**
|
|
|
|
```tsx
|
|
import { Image } from 'react-native'
|
|
|
|
function Avatar({ url }: { url: string }) {
|
|
return <Image source={{ uri: url }} style={styles.avatar} />
|
|
}
|
|
```
|
|
|
|
**Correct (expo-image):**
|
|
|
|
```tsx
|
|
import { Image } from 'expo-image'
|
|
|
|
function Avatar({ url }: { url: string }) {
|
|
return <Image source={{ uri: url }} style={styles.avatar} />
|
|
}
|
|
```
|
|
|
|
**With blurhash placeholder:**
|
|
|
|
```tsx
|
|
<Image
|
|
source={{ uri: url }}
|
|
placeholder={{ blurhash: 'LGF5]+Yk^6#M@-5c,1J5@[or[Q6.' }}
|
|
contentFit="cover"
|
|
transition={200}
|
|
style={styles.image}
|
|
/>
|
|
```
|
|
|
|
**With priority and caching:**
|
|
|
|
```tsx
|
|
<Image
|
|
source={{ uri: url }}
|
|
priority="high"
|
|
cachePolicy="memory-disk"
|
|
style={styles.hero}
|
|
/>
|
|
```
|
|
|
|
**Key props:**
|
|
|
|
- `placeholder` — Blurhash or thumbnail while loading
|
|
- `contentFit` — `cover`, `contain`, `fill`, `scale-down`
|
|
- `transition` — Fade-in duration (ms)
|
|
- `priority` — `low`, `normal`, `high`
|
|
- `cachePolicy` — `memory`, `disk`, `memory-disk`, `none`
|
|
- `recyclingKey` — Unique key for list recycling
|
|
|
|
For cross-platform (web + native), use `SolitoImage` from `solito/image` which uses `expo-image` under the hood.
|
|
|
|
Reference: [expo-image](https://docs.expo.dev/versions/latest/sdk/image/)
|