How saujanmgr/react-native-fast-image works
This is a React Native FastImage implementation for OpenHarmony. An application supplies image props to the React wrapper, which sends them to the native view; the native view resolves sources and coordinates asynchronous remote loading. The loader fetches and decodes images, uses memory and disk caches, and reports downloaded-file updates back across the C++/ArkTS bridge. The package also exposes image sizing, prefetch/cache queries, cache clearing, load events, and image styling. Relationships are limited to those shown in excerpts or the source index; unsampled native details are not expanded.
Main entry points: FastImageViewComponentInstance.cpp View Instance · RemoteImageLoader.ts Remote Loader · FastImageLoaderTurboModule.ts Image Loader Module · FastImageLoaderTurboModule.h Source Resolver
Components 17
React API
- FastImage API
src/index.tsx - Native View Spec
src/FastImageViewNativeComponent.ts
Native View
- View Instance
harmony/fast_image/src/main/cpp/FastImageViewComponentInstance.cpp - Image Node
harmony/fast_image/src/main/cpp/FastImageNode.cpp - Source URI
harmony/fast_image/src/main/cpp/Uri.cpp - Source Resolver
harmony/fast_image/src/main/cpp/FastImageLoaderTurboModule.h - Load Events
harmony/fast_image/src/main/cpp/EventEmitters.cpp - Color Utilities
harmony/fast_image/src/main/cpp/colorUtils/Color.cpp
Image Loading
- Remote Loader
harmony/fast_image/src/main/ets/FastRemoteImageLoader/RemoteImageLoader.ts - Decoded Image Source
harmony/fast_image/src/main/ets/FastRemoteImageLoader/RemoteImageSource.ts - Memory Cache
harmony/fast_image/src/main/ets/FastRemoteImageLoader/RemoteImageCache.ts - Disk Cache
harmony/fast_image/src/main/ets/FastRemoteImageLoader/RemoteImageDiskCache.ts
TurboModule Bridge
- Image Loader Module
harmony/fast_image/src/main/ets/FastImageLoaderTurboModule.ts - View Cache Module
harmony/fast_image/src/main/ets/RNCFastImageViewTurboModule.ts - TurboModule Package
harmony/fast_image/src/main/ets/FastImagePackage.ts
Other components
- Application
- HTTP Fetch
Connections 17
- Application → FastImage API: sets image props
src/index.tsx - FastImage API → Native View Spec: renders
src/index.tsx - View Instance → Image Node: updates
harmony/fast_image/src/main/cpp/FastImageViewComponentInstance.cpp - View Instance → Source URI: parses source
harmony/fast_image/src/main/cpp/FastImageViewComponentInstance.cpp - View Instance → Source Resolver: resolves remote source
harmony/fast_image/src/main/cpp/FastImageViewComponentInstance.cpp - View Instance → Load Events: emits events
- Image Loader Module → Remote Loader: loads image
harmony/fast_image/src/main/ets/FastImageLoaderTurboModule.ts - Remote Loader → HTTP Fetch: fetches data
harmony/fast_image/src/main/ets/FastRemoteImageLoader/RemoteImageLoader.ts - Remote Loader → Memory Cache: checks cache
harmony/fast_image/src/main/ets/FastRemoteImageLoader/RemoteImageLoader.ts - Remote Loader → Disk Cache: reads and writes
harmony/fast_image/src/main/ets/FastRemoteImageLoader/RemoteImageLoader.ts - Remote Loader → Decoded Image Source: creates source
harmony/fast_image/src/main/ets/FastRemoteImageLoader/RemoteImageLoader.ts - Image Loader Module → Source Resolver: posts source updates
harmony/fast_image/src/main/ets/FastImageLoaderTurboModule.ts - Source Resolver → Image Loader Module: receives source messages
harmony/fast_image/src/main/cpp/FastImageLoaderTurboModule.h - View Cache Module → Image Loader Module: clears caches
harmony/fast_image/src/main/ets/RNCFastImageViewTurboModule.ts - TurboModule Package → Image Loader Module: registers module
harmony/fast_image/src/main/ets/FastImagePackage.ts - TurboModule Package → View Cache Module: registers module
harmony/fast_image/src/main/ets/FastImagePackage.ts - View Instance → Color Utilities: uses color parsing
harmony/fast_image/src/main/cpp/FastImageViewComponentInstance.cpp