React Native: expo-image, BlurHash and Video

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Baseline date: 2026-10-07. Versions on npm on that date: expo-image 57.0.5, react-native-blurhash 2.1.3, react-native-fast-image 9.1.0, react-native-video 6.19.3. The core Image component and the sizing rules are in Images and Icons. This page covers what a media backend needs on top: caching, placeholders and video. Check the expo-image documentation for the SDK version you use.

expo-image wraps SDWebImage on iOS and Glide on Android, supports modern formats (WebP, AVIF where the platform allows, HEIC on iOS, SVG), and has first-class placeholder and caching options. It works in bare React Native projects too.

npx expo install expo-image
import { Image } from 'expo-image';

type CoverProps = { url: string; blurhash: string; width: number; height: number };

export function Cover({ url, blurhash, width, height }: CoverProps) {
  return (
    <Image
      source={{ uri: url }}
      placeholder={{ blurhash }}
      contentFit="cover"
      transition={250}
      cachePolicy="memory-disk"
      recyclingKey={url}
      style={{ width, aspectRatio: width / height }}
      accessibilityLabel="Book cover"
    />
  );
}
  • placeholder={{ blurhash }} decodes the BlurHash natively and shows it until the image is ready. The prop also accepts { thumbhash } for ThumbHash and a plain image source, see the algorithm page.

  • cachePolicy is one of none, disk, memory, memory-disk. memory-disk keeps the decoded image in memory for quick re-display and the file on disk. Use disk for large lists where memory is tight.

  • recyclingKey helps in recycled list cells (FlashList and FlatList), so a recycled cell does not show the previous image.

  • contentFit replaces resizeMode (values like cover and contain), and transition cross-fades.

Prefetch the next images, and clear caches when needed:

await Image.prefetch(nextPageUrls, { cachePolicy: 'disk' });
await Image.clearDiskCache();

Choose the URL from the API’s variant list by the size in pixels (PixelRatio.getPixelSizeForLayoutSize(width)) and prefer WebP or AVIF, as in the helper on the Android page. Reference: expo-image placeholder and cachePolicy.

react-native-blurhash

react-native-blurhash renders a BlurHash with a native view, and can encode one from an image on the device.

import { Blurhash } from 'react-native-blurhash';

<Blurhash blurhash="LEHV6nWB2yk8pyo0adR*.7kCMdnj" decodeWidth={32} decodeHeight={32} decodePunch={1}
          style={{ width: 160, height: 240 }} />

Use it with react-native Image or a custom image component when you do not use expo-image, which already includes placeholder support. Its last release at the baseline date was in December 2025, so check that it supports your React Native version and architecture before you add it.

react-native-fast-image

react-native-fast-image wraps SDWebImage and Glide. Its README at the baseline date (version 9.1.0, published 2026-10-06) says it works with React Native 0.65 and later, with the New Architecture through React Native’s interop layer, and that a native New Architecture component is planned for a future major version. It had a long period without updates before this revival, so check its README for the New Architecture status of your React Native version. A community fork, @d11/react-native-fast-image, adds Fabric support.

import FastImage from 'react-native-fast-image';

<FastImage
  style={{ width: 160, height: 240 }}
  source={{ uri: url, priority: FastImage.priority.normal, cache: FastImage.cacheControl.immutable }}
  resizeMode={FastImage.resizeMode.cover}
/>

For a new project, expo-image is the simpler choice. Keep FastImage where an app already depends on it.

react-native-video

react-native-video plays video through ExoPlayer on Android (Media3) and AVPlayer on iOS, so HLS plays natively on both, see Android Media3 and iOS AVFoundation.

import Video from 'react-native-video';

<Video
  source={{ uri: 'https://cdn.example.com/videos/42/master.m3u8' }}
  poster={{ source: { uri: posterUrl } }}
  paused={!playing}
  resizeMode="contain"
  style={{ width: '100%', aspectRatio: 16 / 9 }}
  onError={(e) => console.warn(e)}
/>

The API differs between major versions (version 7 moved to a player object and a useVideoPlayer hook), so follow the documentation of the version you install. Expo offers expo-video as an alternative with a similar approach, see expo-video. Create the poster as described in video covers and thumbnails.

Compressing before upload

expo-image-manipulator resizes and re-encodes images (JPEG, PNG, WebP) on the device, and libraries such as react-native-compressor compress video. See device-side compression and uploads.

One component, two native pipelines

A React Native image component is a thin wrapper, so the behaviour that matters (decoding, caching, downsampling) is that of the native library below it. Knowing which one runs explains why the same props behave a little differently on each platform.

flowchart TD API["API: cover b81f, variants, blurhash"] --> PV["pickVariant: format, then width at least the pixels"] PV --> EI["expo-image Image component"] EI --> IOS["iOS: SDWebImage"] EI --> AND["Android: Glide"] IOS --> MC["Memory cache, decoded"] AND --> MC IOS --> DC["Disk cache, encoded"] AND --> DC DC --> NET["CDN"] EI -.->|"placeholder prop"| BH["BlurHash decoded natively"]

The decision that React Native code makes is the first box: which URL to hand over. Logical sizes (width={160}) are in density-independent units, so the pixels needed are PixelRatio.getPixelSizeForLayoutSize(160), which is 480 on a 3x screen and 420 on a phone with a ratio of 2.625. The function below picks the format first (AVIF on Android 12 and later and on iOS 16 and later, then WebP, then JPEG) and then the smallest width that is large enough. It is plain JavaScript, so it was run in Node with the two react-native imports replaced by small stubs, using the cover JSON of the responsive images page (AVIF at 320, 640 and 1280, WebP at 640, JPEG at 320 and 640):

import { PixelRatio, Platform } from 'react-native';

type Variant = { format: 'avif' | 'webp' | 'jpeg'; width: number; url: string };

function decodableFormats(): Variant['format'][] {
  const avif = Platform.OS === 'android'
    ? Number(Platform.Version) >= 31                            // Platform.Version is the API level on Android
    : Platform.OS === 'ios' && parseInt(String(Platform.Version), 10) >= 16;   // and a version string on iOS
  return avif ? ['avif', 'webp', 'jpeg'] : ['webp', 'jpeg'];
}

export function pickVariant(variants: Variant[], layoutWidth: number): Variant {
  const pixels = PixelRatio.getPixelSizeForLayoutSize(layoutWidth);
  for (const format of decodableFormats()) {
    const sorted = variants.filter((v) => v.format === format).sort((a, b) => a.width - b.width);
    const hit = sorted.find((v) => v.width >= pixels) ?? sorted.at(-1);
    if (hit) return hit;
  }
  throw new Error('no variant');
}
Device Pixels wanted Variant chosen

iOS 17.2, ratio 3, 160 dp

480

w640.avif

iOS 15.8, ratio 3, 160 dp

480

w640.webp

Android 34, ratio 2.625, 160 dp

420

w640.avif

Android 29, ratio 2.625, 160 dp

420

w640.webp

Android 34, ratio 3, 420 dp

1260

w1280.avif

The same list, the same rule and the same results appear on the Android and iOS pages, so a cover looks the same natively and in React Native, and a backend change (a new width) needs no app release.

Worked example: the cover grid

A grid of covers combines the variant, the placeholder and the cache policy. The tile reserves its space from the intrinsic size of the cover, so nothing moves when the picture arrives:

import { Image } from 'expo-image';
import { FlatList, useWindowDimensions } from 'react-native';

type Cover = { id: string; width: number; height: number; blurhash: string; variants: Variant[] };

function CoverTile({ cover, tileWidth }: { cover: Cover; tileWidth: number }) {
  const variant = pickVariant(cover.variants, tileWidth);
  return (
    <Image
      source={{ uri: variant.url, cacheKey: `${cover.id}-${variant.format}-${variant.width}` }}
      placeholder={{ blurhash: cover.blurhash }}
      contentFit="cover"
      transition={200}
      recyclingKey={cover.id}
      style={{ width: tileWidth, aspectRatio: cover.width / cover.height }}
    />
  );
}

export function CoverGrid({ covers }: { covers: Cover[] }) {
  const { width } = useWindowDimensions();
  const tileWidth = Math.floor((width - 16 * 3) / 2);          // two columns with 16 dp gutters
  return (
    <FlatList
      data={covers}
      numColumns={2}
      keyExtractor={(cover) => cover.id}
      renderItem={({ item }) => <CoverTile cover={item} tileWidth={tileWidth} />}
      windowSize={7}
    />
  );
}

cacheKey matters when the CDN signs URLs: a signature in the query string changes on every API response, and a cache keyed by the full URL would then miss every time. A stable key built from the cover id, format and width makes the cache hit regardless of the signature. recyclingKey and windowSize keep recycled cells from showing the previous cover and bound how many tiles stay mounted. The decoded size of a 480 by 720 tile is 1.32 MiB, so twenty visible tiles hold about 26 MiB (width times height times 4 bytes), compared with 659 MiB if the 2400 by 3600 original were decoded for each.

Prefetch the next page by choosing the variant for the same tile width, so that the prefetched file is the one that will be displayed:

export async function prefetchCovers(covers: Cover[], tileWidth: number) {
  const urls = covers.map((cover) => pickVariant(cover.variants, tileWidth).url);
  await Image.prefetch(urls, { cachePolicy: 'disk' });
}

Prefetching the variant that the tile will request is what makes the cache hit: prefetching a different width warms a different file, and the tile still downloads its own.

Compress and hash before the upload

Compressing before an upload reuses the sizing rule of this page, applied to the camera image. expo-image-manipulator has a context-based API that chains operations and then renders once:

import { ImageManipulator, SaveFormat } from 'expo-image-manipulator';
import { Image } from 'expo-image';

export async function prepareCover(uri: string, photoWidth: number, photoHeight: number) {
  const context = ImageManipulator.manipulate(uri);
  context.resize(photoHeight > photoWidth ? { height: 2048 } : { width: 2048 });   // cap the long side
  const rendered = await context.renderAsync();
  const file = await rendered.saveAsync({ format: SaveFormat.WEBP, compress: 0.8 });
  const blurhash = await Image.generateBlurhashAsync(file.uri, [4, 3]);   // 4 by 3 components, 28 characters
  return { uri: file.uri, width: file.width, height: file.height, blurhash };
}

resize keeps the aspect ratio when only one dimension is given, so the cap goes on the long side whichever way the photo was taken (the picker result provides the width and height). The older manipulateAsync function is still found in many projects and does the same in one call. Send the BlurHash with the upload as a hint, and let the worker recompute it, as on the device-side compression page, where the parts, retries and resume logic were run as a Node script. The orchestration (planning parts, asking the service which parts exist, retrying with backoff) is JavaScript, so it applies to a React Native app unchanged, while the transfer itself should use the platform’s background service through the wrappers named in that page.

For video, react-native-compressor wraps the native encoders:

import { Video } from 'react-native-compressor';

const compressed = await Video.compress(
  pickedVideoUri,
  { compressionMethod: 'auto' },
  (progress) => setProgress(progress),                          // 0 to 1
);

The result is a file URI of a smaller video, which the server still transcodes into the ladder. The Android and iOS engines behind it differ in quality, as the notes on Media3 Transformer and AVAssetExportSession describe.