$ show duguyihou/react-native-turbo-image
react-native-turbo-image is a high-performance React Native native module that replaces the built-in Image component with advanced image loading, caching, and processing capabilities. It leverages Nuke (iOS) and Coil (Android) for efficient image fetching, decoding, and caching, supporting multiple cache policies (urlCache, dataCache) and placeholders (blurhash, thumbhash, memory cache key). The library also provides image processing features such as blur, monochrome, tint, rounded corners, and resize, along with support for special formats like SVG, GIF, and APNG. Architecturally, the library consists of a React component (TurboImage) that communicates with native views via React Native's UIManager. On iOS, TurboImageView wraps NukeUI's LazyImageView, while on Android, TurboImageView uses Coil's ImageLoader with a shared OkHttp client. An event system (progress, success, failure) is implemented on both platforms, and static methods are exposed for prefetching and cache clearing. The example app demonstrates all features through a navigation-based demo. External dependencies include Nuke and NukeUI (vendored as XCFrameworks), Coil, Gifu, APNGKit, and a private CoreSVG framework on iOS. The library is published on npm and follows conventional commits. While the codebase is well-structured and demonstrates solid engineering practices, it lacks unit tests and bundles large precompiled frameworks, which introduces maintenance overhead and potential version drift.
The LLM identified 3 files worth highlighting for reuse:
A self-contained Swift extension on UIImage that decodes a blurhash string into a UIImage. It uses Core Graphics to generate a pixel buffer from the blurhash components and creates a UIImage from it. This component is reusable in any iOS project that needs to display blurhash placeholders, independent of React Native or the rest of the library.
A self-contained Swift extension on UIImage that decodes a thumbhash (a compact image placeholder format) into a UIImage. It implements the thumbhash decoding algorithm using Core Graphics. This component is reusable in any iOS project requiring thumbhash placeholder support, independent of the host framework.
An OkHttp interceptor that tracks download progress by wrapping response bodies with a ProgressResponseBody. It uses a ProgressListeners registry keyed by view tags to emit progress events to React Native. This pattern is reusable in any Android project that needs to report download progress from OkHttp, and it demonstrates clean separation of concerns with the interceptor pattern.