finds.dev← search

// the find

wcandillon/react-native-img-cache

★ 728 · TypeScript · Apache-2.0 · updated Jun 2020

Image Cache for React Native

A React Native component and image manager that downloads remote images to the device's file system through rn-fetch-blob and serves them from local paths on later renders. It is aimed at apps that need offline-friendly image lists and predate, or need more than, the platform's iOS-only `cache: force-cache` option. The author has deprecated it and stopped maintaining it, so treat it as reference code and check forks before adopting it.

The immutable/mutable split is a clear model: `CachedImage` assumes the URI never changes, and the `mutable` flag switches to a cache that can be busted by hand with `ImageCache.get().bust(uri)`. The observer API (`on` / `dispose`) hands you the local file path as soon as it is ready, which makes it usable outside of the component. `cancel(uri)` is the right hook for fast-scrolling lists, where you don't want downloads for rows that have already left the screen. `CustomCachedImage` accepts any component plus an indicator, so a progress UI can be swapped in without forking the library.

The package has not been pushed since June 2020 and the README says it is no longer maintained, so React Native upgrades and newer platform versions are unverified. It depends on rn-fetch-blob, a native module, which rules out Expo managed workflow and adds native linking work to every project. The README documents no size limit or eviction policy, only `clear()` and `bust()`, so a long-running app can grow its disk usage without bound. `source` takes only a single `uri`, with no array fallbacks and no `body`, so anything beyond a plain GET needs a different approach.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →