finds.dev← search

// the find

wcandillon/react-native-expo-image-cache

★ 682 · TypeScript · MIT · updated Jan 2023

React Native Image Cache and Progressive Loading based on Expo

A React Native image component and cache manager that downloads remote images to local storage and shows a preview while the full image loads. It is aimed at Expo-based apps that want a drop-in replacement for the stock Image component, and the source is three files small enough to read in one sitting.

- The preview prop accepts a data URI or local asset, so a tiny thumbnail can show immediately, and transitionDuration (default 300ms) controls the fade to the full image. That is the progressive loading the name promises.

- CacheManager.get(uri).getPath() resolves to a local file path, so the cached file can be reused outside the component, for example for sharing or passing to native code.

- The API surface is small: one component, one cache manager, and clearCache() for cleanup. When something breaks, the cause is readable in the source without digging through a dependency tree.

- Last push was January 2023, and the README still says it is based on Expo Kit, which Expo has retired. Verify it against your current Expo SDK before adopting, since anything touching Expo's file system APIs has changed since then.

- Failure is signalled only by getPath() returning undefined, with no error or reason. Callers cannot tell a network error, a 404, and a disk problem apart.

- Nothing in the README mentions a size limit, eviction policy, or expiry, and clearCache() is the only management call. Assume the cache grows until something clears it.

- The props table is thin. The tint option has three values (light, dark, default) with no explanation of what it changes, so you will need to check the source or try it on a device to know.

View on GitHub →

// 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 →