Images and caching
Responsive images (srcset)
Section titled “Responsive images (srcset)”The carousel measures its media area, multiplies by the device pixel ratio and picks an image that is sharp enough without downloading more than needed. There are two ways to offer sizes.
A list of variants, the React Native form of srcset (width is the w descriptor):
getImage={(p) => [ { uri: `${p.base}-640.jpg`, width: 640, height: 480 }, { uri: `${p.base}-1280.jpg`, width: 1280, height: 960 }, { uri: `${p.base}-2560.jpg`, width: 2560, height: 1920 },]}The smallest variant at least as wide as needed wins; with height set, cover and contain account for the aspect ratio. A variant already in the cache is preferred when it is at most twice the needed width.
A URL built for the size, for image CDNs (imgix, Cloudinary, Unsplash, a Next.js-style resizer). The third argument is the target in physical pixels, rounded up to one of a few widths (WIDTH_STEPS: 320, 480, 640, 750, 828, 1080, 1200, 1440, 1920, 2560, …) so the CDN and the cache see a handful of URLs per image, not one per device:
getImage={(p, i, target) => ({ uri: `https://images.unsplash.com/photo-${p.id}?w=${target.width}&h=${target.height}&fit=crop`,})}target has width, height, pixelRatio, layoutWidth, layoutHeight (dp) and fit.
There is no sizes: HTML needs it because the browser chooses before layout, the carousel chooses after.
Rotation and resizing. When the area grows (portrait to landscape, a split-screen resize, a window on web), the sharper variant is downloaded in the background while the current image stays on screen, then cross-faded in over 220 ms once decoded. When the area shrinks, the sharper image already shown is kept and nothing is downloaded, like browsers do. There is never an empty frame. With the liquid effect, the image follows the new size one frame after the layout change (the re-render that reads it): measuring the canvas on the UI thread instead would cost a measurement in every frame for as long as the carousel is mounted.
Remote images and caching
Section titled “Remote images and caching”Remote images ({ uri: 'https://…' }) go through a disk cache that is on by default. Each image is stored with the time it was fetched and when it expires.
// A module constant (or useMemo): the carousel memoizes the options on identity.const CACHE = { strategy: 'stale-while-revalidate', // default maxAge: 6 * 60 * 60 * 1000, // 6 hours when the server sends no Cache-Control} as const;
<MorphCarousel imageCache={CACHE} getImage={(p) => ({ uri: p.imageUrl })} … />| Strategy | Cached and fresh | Cached and expired | Not cached |
|---|---|---|---|
stale-while-revalidate (default) |
Shown, no request | Shown at once, revalidated in the background, swapped if the server has a new version. Past maxStale it waits for the network instead |
Downloaded |
cache-first |
Shown, no request | Waits for the network; the old copy is the fallback when offline | Downloaded |
network-first |
Revalidated before showing; the cached copy is the fallback when offline | Same | Downloaded |
How long an image is fresh:
- If the server sends
Cache-Control: max-age(orExpires), that lifetime is used.no-cachemeans “always revalidate”,no-storemeans “do not write it to disk”. SetrespectHttpHeaders: falseto always usemaxAge. - Otherwise
maxAge(default 24 hours).
Revalidation sends If-None-Match / If-Modified-Since. When the image has not changed, the server answers 304 and no image data is transferred. When it has changed, the new file gets a new name, so the image view reloads, and the old file is deleted. An image that stays on screen is revalidated when it expires, not only when it mounts.
Options of imageCache:
| Option | Default | Description |
|---|---|---|
strategy |
'stale-while-revalidate' |
See the table above |
maxAge |
24 h | Lifetime in ms when the server sends none |
maxStale |
7 days | How long past expiry stale-while-revalidate may still show an old image while the new one loads |
respectHttpHeaders |
true |
Use Cache-Control / Expires and honor no-store |
headers |
Request headers, for example Authorization |
|
getCacheKey(url) |
the URL | For signed URLs whose query changes on every request: (url) => url.split('?')[0] |
Pass imageCache={false} to load straight from the network.
Load order and prefetching
Section titled “Load order and prefetching”Downloads go through one queue with a limit of parallel requests (4 by default) and three priorities:
| Priority | Used for |
|---|---|
high |
The image of the page in view |
normal |
Its neighbors (one page away) |
low |
Pages further away in the render window, prefetches, background revalidations |
When the user swipes, the images of the new page are moved up the queue, so a fast swipe does not wait behind downloads for pages already passed.
Beyond the render window (windowSize), the carousel downloads the images of prefetch more pages on each side (default 1) without rendering them, choosing the same variant the page will choose when it mounts. prefetch={0} turns it off.
To download images before the carousel exists (the next screen, a list item scrolling into view), use the hook or the function:
import { imageTargetFor, usePrefetchImages, imageCache } from 'expo-morph-carousel';
// In the screen before: build the URLs the carousel will requestconst target = imageTargetFor({ width: screenWidth - 32, height: 240 }, PixelRatio.get(), 'cover');const { loaded, total, failed, done } = usePrefetchImages( products.map((p) => cdnUrl(p.image, target.width)), { priority: 'low' }, // default; `enabled: false` to wait);
// Or imperatively, for example after a list request resolvesawait imageCache.prefetch(urls, cacheOptions, 'low');imageTargetFor is the function the carousel uses for getImage’s target, so the prefetched URL is the one the carousel asks for.
Limits
Section titled “Limits”| Setting | Default | |
|---|---|---|
maxSize |
100 MB | Bytes on disk. Least recently used files are deleted first |
maxEntries |
500 | Files on disk |
maxConcurrent |
4 | Parallel downloads; the rest wait in priority order |
decodedImages |
24 | Decoded images kept in memory for the liquid effect. Each costs width × height × 4 bytes (a 1080×810 photo ≈ 3.5 MB), so 24 such photos ≈ 84 MB. Lower it for large photos on low-memory devices |
decodedBytes |
96 MB | Memory budget for those decoded images; the least recently used go first when either limit is reached |
imageCache.configure({ maxSize: 50 * 1024 * 1024, maxEntries: 300, maxConcurrent: 6, decodedImages: 12 });imageCache.getConfig(); // current valuesconfigure takes effect immediately; lowering maxSize or maxEntries evicts right away. Call it once at startup (for example in the root layout).
Inspecting and clearing
Section titled “Inspecting and clearing”imageCache.getEntry(url); // { fetchedAt, expiresAt, etag, size, … }imageCache.stats(); // { hits, misses, revalidations, notModified, updates, errors, entries, size, active, queued }const stats = useImageCacheStats(); // the same, live, for a debug panelawait imageCache.remove(url);await imageCache.clear(); // for example on sign outFiles live in <cache directory>/expo-morph-carousel/ on iOS and Android (the OS may clear it when storage is low) and in Cache Storage on web. Decoded images are also kept in memory (the last 24), so swiping back and forth does not decode them again.
To try it, the example app has a local image server that sends ETag and Cache-Control and can swap its images:
npm run image-server --workspace example # http://localhost:8090, max-age 30 sadb reverse tcp:8090 tcp:8090 # Android emulatorOpen “Remote images” in the example app. The panel shows when the current image was fetched, how long it stays fresh, and the cache counters; “Swap images on server” changes what every URL returns.
Source of the demo
Section titled “Source of the demo”import Constants from 'expo-constants';import { imageCache, MorphCarousel, type CacheStrategy, type ImageCacheOptions, type MorphCarouselRef, useImageCacheStats, WIDTH_STEPS,} from 'expo-morph-carousel';import { useEffect, useMemo, useRef, useState } from 'react';import { PixelRatio, Platform, Pressable, ScrollView, StyleSheet, Switch, Text, useWindowDimensions, View,} from 'react-native';
import { heightFor, photos, REMOTE_MEDIA_HEIGHT, REMOTE_SIDE_MARGIN, unsplashUrl } from '../data/products';import { column } from '../data/layout';
/** * Remote images through the carousel's disk cache. * * "Local server" talks to example/scripts/image-server.mjs, which sends ETag * and Cache-Control headers and can swap its images, so every cache path can * be watched: a fresh hit (no request), a 304 revalidation after expiry, and a * new image replacing a stale one after "Swap images on server". */
type Source = 'local' | 'unsplash';
/** Host of the computer running Metro, which also runs the image server. */function serverHost() { if (Platform.OS === 'web') return typeof location === 'undefined' ? 'localhost' : location.hostname; const hostUri = Constants.expoConfig?.hostUri ?? 'localhost:8081'; return hostUri.split(':')[0];}const SERVER = `http://${serverHost()}:8090`;
const localItems = [0, 1, 2, 3, 4].map((n) => ({ id: `local-${n}`, title: `Image ${n + 1}`, uri: `${SERVER}/img/${n}.png`, color: ['#6a4fd8', '#f0a020', '#20a890', '#3478f6', '#eb405a'][n],}));
type Item = { id: string; title: string; uri: string; color: string; unsplash?: string };
const STRATEGIES: CacheStrategy[] = ['stale-while-revalidate', 'cache-first', 'network-first'];const AGES: { label: string; ms: number }[] = [ { label: '10 s', ms: 10_000 }, { label: '1 min', ms: 60_000 }, { label: '1 day', ms: 86_400_000 },];
export default function RemoteScreen() { const [source, setSource] = useState<Source>('local'); const [strategy, setStrategy] = useState<CacheStrategy>('stale-while-revalidate'); const [maxAge, setMaxAge] = useState(AGES[0].ms); const [serverHeaders, setServerHeaders] = useState(true); const [enabled, setEnabled] = useState(true); const [tapImage, setTapImage] = useState(true); const [keepCorners, setKeepCorners] = useState(true); const [index, setIndex] = useState(0); const [note, setNote] = useState(''); const carousel = useRef<MorphCarouselRef>(null);
const items: Item[] = source === 'local' ? localItems : photos.map((p) => ({ id: p.id, title: p.title, uri: p.uri, color: p.color, unsplash: p.id })); const screen = useWindowDimensions();
// Stable options object: the carousel memoizes on identity. const cache = useMemo<ImageCacheOptions | false>( () => (enabled ? { strategy, maxAge, respectHttpHeaders: serverHeaders } : false), [enabled, strategy, maxAge, serverHeaders], );
const stats = useImageCacheStats(); const config = imageCache.getConfig(); const now = useNow(); const current = items[index]; // Unsplash items exist in several sizes (one URL per target width); show // every cached variant, newest first, to see the upgrade after a rotation. const variants = current?.unsplash ? WIDTH_STEPS.map((w) => ({ w, e: imageCache.getEntry(unsplashUrl(current.unsplash!, w, heightFor(w))) })) .filter((v) => v.e) .sort((a, b) => b.e!.fetchedAt - a.e!.fetchedAt) : []; const entry = current?.unsplash ? variants[0]?.e : current ? imageCache.getEntry(current.uri) : undefined;
const call = async (path: string) => { try { const res = await fetch(`${SERVER}${path}`); setNote((await res.text()).trim()); } catch { setNote(`Server not reachable at ${SERVER}. Run: npm run image-server --workspace example`); } };
return ( <ScrollView contentInsetAdjustmentBehavior="automatic" contentContainerStyle={[styles.screen, column]}> <MorphCarousel key={source} ref={carousel} testID="remote-carousel" data={items} keyExtractor={(p) => p.id} // Unsplash: ask the CDN for exactly the size the media area needs // (target is in physical pixels, rounded to a few widths). getImage={(p, _i, t) => ({ uri: p.unsplash ? unsplashUrl(p.unsplash, t.width, heightFor(t.width)) : p.uri, })} getPlaceholderColor={(p) => p.color} getAccessibilityLabel={(p) => p.title} accessibilityLabel="Remote images" imageCache={cache} mediaFit={source === 'local' ? 'contain' : 'cover'} mediaPadding={source === 'local' ? 24 : 0} mediaHeight={REMOTE_MEDIA_HEIGHT} // Photos: keep the rectangle sharp while the content melts (no rounded, // eaten-in corners). Shapes on a transparent background melt whole. liquid={ source === 'local' ? { preserveShape: keepCorners } : { blur: 36, threshold: 0.35, preserveShape: keepCorners } } // Tap the image: left 30% back, the rest forward. Taps on the text // below do nothing. tapToNavigate={tapImage ? { area: 'media' } : false} loop onIndexChange={setIndex} style={styles.card} renderItem={({ item }) => ( <View style={styles.page}> <Text style={styles.title}>{item.title}</Text> <Text style={styles.meta} numberOfLines={1}> {item.uri.replace(/^https?:\/\//, '')} </Text> </View> )} />
<View style={styles.panel}> <Text style={styles.panelTitle}>Current image</Text> <Text style={styles.mono}> {entry ? `fetched ${ago(now - entry.fetchedAt)} ago · ${ entry.expiresAt > now ? `fresh for ${ago(entry.expiresAt - now)}` : `stale ${ago(now - entry.expiresAt)}` }${entry.etag ? ` · ETag ${entry.etag}` : ''}` : enabled ? 'not cached yet' : 'cache off'} {variants.length > 0 && `\nvariants: ${variants.map((v) => `${v.w}w`).join(', ')} (newest first)`} </Text> <Text style={styles.panelTitle}>Screen</Text> <Text style={styles.mono}> {Math.round(screen.width)}×{Math.round(screen.height)} dp @{PixelRatio.get()}x ·{' '} {screen.width > screen.height ? 'landscape' : 'portrait'} </Text> <Text style={styles.panelTitle}>Cache</Text> <Text style={styles.mono}> {imageCache.isAvailable() ? '' : 'no store on this platform · '} {stats.entries} files · {(stats.size / 1024).toFixed(0)} KB{'\n'} hits {stats.hits} · downloads {stats.misses} · revalidations {stats.revalidations} {'\n'}304 {stats.notModified} · updated {stats.updates} · errors {stats.errors} {'\n'}downloading {stats.active} · queued {stats.queued} {'\n'}limits {Math.round(config.maxSize / 1048576)} MB · {config.maxEntries} files ·{' '} {config.maxConcurrent} parallel · {config.decodedImages} decoded ·{' '} {Math.round(config.decodedBytes / 1048576)} MB </Text> </View>
<Section label="Source"> <Chips values={['local', 'unsplash'] as Source[]} labels={{ local: 'Local server', unsplash: 'Unsplash' }} value={source} onChange={setSource} /> </Section> <Section label="Strategy"> <Chips values={STRATEGIES} value={strategy} onChange={setStrategy} /> </Section> <Section label={serverHeaders ? 'maxAge (used when the server sends no Cache-Control)' : 'maxAge'}> <Chips values={AGES.map((a) => a.ms)} labels={Object.fromEntries(AGES.map((a) => [a.ms, a.label]))} value={maxAge} onChange={setMaxAge} /> </Section>
<View style={styles.toggles}> <Toggle label="Tap the image to change page" value={tapImage} onChange={setTapImage} /> <Toggle label="Keep image corners while morphing" value={keepCorners} onChange={setKeepCorners} /> <Toggle label="Cache enabled" value={enabled} onChange={setEnabled} /> <Toggle label="Use server Cache-Control / ETag" value={serverHeaders} onChange={setServerHeaders} /> </View>
<View style={styles.buttons}> <Button label="Prefetch all" onPress={() => void imageCache.prefetch( items.map((i) => i.uri), cache || undefined, ) } /> <Button label="Clear cache" onPress={() => void imageCache.clear()} /> {source === 'local' && ( <> <Button label="Swap images on server" onPress={() => void call('/swap')} /> <Button label="Server max-age 10 s" onPress={() => void call('/config?maxAge=10')} /> <Button label="Server max-age 1 h" onPress={() => void call('/config?maxAge=3600')} /> </> )} </View> {!!note && <Text style={styles.note}>{note}</Text>} {source === 'local' && ( <Text style={styles.note}> Server: {SERVER}. Start it with `npm run image-server --workspace example`; on an Android emulator also run `adb reverse tcp:8090 tcp:8090`. </Text> )} {source === 'unsplash' && ( <Text style={styles.note}> Photos from Unsplash (unsplash.com, Unsplash License). The CDN sends Cache-Control max-age of one year: with the “Use server Cache-Control” switch on, the cache keeps them that long; turn it off to use maxAge. </Text> )} </ScrollView> );}
function useNow() { const [now, setNow] = useState(() => Date.now()); useEffect(() => { const t = setInterval(() => setNow(Date.now()), 1000); return () => clearInterval(t); }, []); return now;}
function ago(ms: number) { const s = Math.round(ms / 1000); if (s < 90) return `${s} s`; if (s < 5400) return `${Math.round(s / 60)} min`; return `${Math.round(s / 3600)} h`;}
function Section({ label, children }: { label: string; children: React.ReactNode }) { return ( <View style={styles.section}> <Text style={styles.label}>{label}</Text> {children} </View> );}
function Chips<V extends string | number>({ values, labels, value, onChange,}: { values: V[]; labels?: Record<string, string>; value: V; onChange: (v: V) => void;}) { return ( <View style={styles.chips}> {values.map((v) => ( <Pressable key={String(v)} onPress={() => onChange(v)} style={[styles.chip, v === value && styles.chipOn]} > <Text style={[styles.chipText, v === value && styles.chipTextOn]}> {labels?.[String(v)] ?? String(v)} </Text> </Pressable> ))} </View> );}
function Toggle({ label, value, onChange,}: { label: string; value: boolean; onChange: (v: boolean) => void;}) { return ( <View style={styles.toggle}> <Text style={styles.toggleText}>{label}</Text> <Switch value={value} onValueChange={onChange} accessibilityLabel={label} /> </View> );}
function Button({ label, onPress }: { label: string; onPress: () => void }) { return ( <Pressable style={styles.button} onPress={onPress} accessibilityRole="button"> <Text style={styles.buttonText}>{label}</Text> </Pressable> );}
const styles = StyleSheet.create({ screen: { padding: REMOTE_SIDE_MARGIN, gap: 12 }, card: { height: 380, borderRadius: 24, backgroundColor: '#fff' }, page: { flex: 1, alignItems: 'center', justifyContent: 'center', gap: 6, paddingHorizontal: 16 }, title: { fontSize: 22, fontWeight: '700', color: '#1c1c1e' }, meta: { fontSize: 12, color: '#6e6e73' }, panel: { borderRadius: 16, backgroundColor: '#1c1c1e', padding: 14, gap: 4 }, panelTitle: { fontSize: 12, fontWeight: '600', color: '#8e8e93', textTransform: 'uppercase' }, mono: { fontSize: 13, color: '#f2f2f7', fontFamily: Platform.select({ ios: 'Menlo', default: 'monospace' }), }, section: { gap: 6 }, label: { fontSize: 13, color: '#6e6e73' }, chips: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 }, chip: { paddingHorizontal: 12, paddingVertical: 8, borderRadius: 999, backgroundColor: '#fff' }, chipOn: { backgroundColor: '#5b4bd6' }, chipText: { fontSize: 14, color: '#1c1c1e' }, chipTextOn: { color: '#fff', fontWeight: '600' }, toggles: { borderRadius: 16, backgroundColor: '#fff', paddingHorizontal: 14 }, toggle: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingVertical: 8 }, toggleText: { fontSize: 15, color: '#1c1c1e', flexShrink: 1 }, buttons: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 }, button: { paddingHorizontal: 14, paddingVertical: 10, borderRadius: 12, backgroundColor: '#e5e5ea' }, buttonText: { fontSize: 14, fontWeight: '600', color: '#1c1c1e' }, note: { fontSize: 12, color: '#6e6e73' },});import type { ImageSourcePropType } from 'react-native';
export type Product = { id: string; title: string; description: string; image: ImageSourcePropType; /** Shown as a blob while the image loads, and used for accents. */ color: string;};
export const products: Product[] = [ { id: 'orb', title: 'Meet Orb', description: 'A glossy sphere with a soft highlight. Swipe to watch it melt into the next shape.', image: require('../assets/shapes/orb.png'), color: '#6a4fd8', }, { id: 'tile', title: 'Explore Tile', description: 'A rounded square with a warm gradient, the kind of shape app icons are made of.', image: require('../assets/shapes/tile.png'), color: '#f0a020', }, { id: 'ring', title: 'Discover Ring', description: 'A torus with a hole in the middle. The liquid effect fills it in, then opens it again.', image: require('../assets/shapes/ring.png'), color: '#20a890', }, { id: 'pill', title: 'Experience Pill', description: 'A tall capsule. Tall and wide shapes stretch the blob in between.', image: require('../assets/shapes/pill.png'), color: '#3478f6', }, { id: 'heart', title: 'Love Heart', description: 'Two circles and a point. Watch the point grow out of the blob.', image: require('../assets/shapes/heart.png'), color: '#eb405a', },];
/** * Devices for the product showcase: original drawings (example/scripts/ * make-devices.mjs), cropped to their outline. Dark bodies and glowing * screens of different colors make the liquid morph easy to follow. */export const devices: Product[] = [ { id: 'watch', title: 'Meet Orbit Watch', description: 'A rounded case on a woven band. Swipe and it melts into the next device.', image: require('../assets/devices/watch.png'), color: '#6a4fd8', }, { id: 'phone', title: 'Nova Phone', description: 'Edge-to-edge glass with an ocean wallpaper, tall and narrow.', image: require('../assets/devices/phone.png'), color: '#0b7fc4', }, { id: 'laptop', title: 'Explore Slate Laptop', description: 'A wide screen on a thin base: the blob stretches from tall to wide.', image: require('../assets/devices/laptop.png'), color: '#c2368f', }, { id: 'mini', title: 'Cube Mini', description: 'A small silver box with no screen at all, seen from above.', image: require('../assets/devices/mini.png'), color: '#8f959d', }, { id: 'desktop', title: 'Vista Desktop', description: 'A large display with a sunset on a round foot.', image: require('../assets/devices/desktop.png'), color: '#e0566b', },];
/** * Product photos for the showcase, cut out of their studio background and * cropped to the product. Tall and wide products alternate, so the liquid * blob visibly stretches from one outline to the next. */export const showcase: Product[] = [ { id: 'watch-plum', title: 'Watch Series 12', description: 'A plum sport band and an always-on display. Swipe and it melts into the next product.', image: require('../assets/showcase/watch-plum.png'), color: '#5c1f33', }, { id: 'macbook', title: 'MacBook Pro 14', description: 'From a tall watch to a wide laptop: the blob stretches sideways on the way.', image: require('../assets/showcase/macbook.png'), color: '#2c2c30', }, { id: 'iphone-red', title: 'iPhone 18 Pro', description: 'Tall and narrow again, in a deep red finish with a three-camera plateau.', image: require('../assets/showcase/iphone-red.png'), color: '#6e2334', }, { id: 'mini-front', title: 'Mac mini', description: 'The widest of all: a low silver box, seen from the front.', image: require('../assets/showcase/mini-front.png'), color: '#6b7076', }, { id: 'iphone-white', title: 'iPhone 18 Pro, white', description: 'The back and the side: two outlines the liquid has to join.', image: require('../assets/showcase/iphone-white.png'), color: '#7d7a76', }, { id: 'iphone-duo', title: 'iPhone Duo', description: 'A phone that unfolds into a small laptop, half open.', image: require('../assets/showcase/iphone-duo.png'), color: '#1f2b45', }, { id: 'watch-starlight', title: 'Watch Series 12, starlight', description: 'A light band and a vivid purple face, back to a tall outline.', image: require('../assets/showcase/watch-starlight.png'), color: '#6a3fc8', }, { id: 'mini-top', title: 'Mac mini, from above', description: 'A rounded square to finish: the blob settles into an even shape.', image: require('../assets/showcase/mini-top.png'), color: '#5e6369', },];
/** Media height of the remote screen's carousel; the home screen prefetches for it. */export const REMOTE_MEDIA_HEIGHT = 240;/** Horizontal padding of the remote screen around the carousel. */export const REMOTE_SIDE_MARGIN = 16;
/** Photos are requested at 4:3; the carousel covers its area and crops the rest. */export const heightFor = (width: number) => Math.round((width * 3) / 4);
/** * An Unsplash image URL at a given size. Unsplash serves through imgix, which * resizes on the fly: `w` and `h` in pixels, `fit=crop` fills the box. */export function unsplashUrl(id: string, width: number, height: number) { return `https://images.unsplash.com/photo-${id}?w=${width}&h=${height}&fit=crop&q=80&fm=jpg`;}
/** * Remote photos for the image-loading demo, from Unsplash (free to use under * the Unsplash License, https://unsplash.com/license). `uri` is a fixed 800 px * variant; the remote screen builds the URL per size with `unsplashUrl`. * * Unsplash answers with `Cache-Control: max-age=31536000` (one year), so with * `respectHttpHeaders` on, the cache keeps these for a year. */export const photos = [ { id: '1506905925346-21bda4d32df4', title: 'Sea of clouds', color: '#5b6478' }, { id: '1501785888041-af3ef285b470', title: 'Alpine lake', color: '#2fa7a0' }, { id: '1470071459604-3b5ec3a7fe05', title: 'Misty valley', color: '#6e7a5a' }, { id: '1441974231531-c6227db76b6e', title: 'Forest path', color: '#3e4a2c' }, { id: '1507525428034-b723cf961d3e', title: 'Beach at sunset', color: '#7fc4c8' }, { id: '1500530855697-b586d89ba3ee', title: 'Desert road', color: '#a0553c' }, { id: '1433086966358-54859d0ed716', title: 'Waterfall', color: '#3f6b3a' },].map((p) => ({ ...p, uri: unsplashUrl(p.id, 800, 600),}));View on GitHub: app/remote.tsxView on GitHub: data/products.ts