Repository navigation
Description
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
- Using image prefetch does not work at all on iOS.
- Preloading the images and then checking
Image.queryCacheshows an empty query cache - Attempting to display images that have been prefetched using
cache: 'only-if-cached'will result in no image shown - Works absolutely fine on Android
- There are a number of other issues reporting the same thing in the past this one and another
- https://www.npmjs.com/package/react-native-fast-image provides the same behaviour so perhaps this isn't getting much traction but I'm keen to not add on libraries for something that is supposed to be supported
React Native version:
System:
OS: macOS 10.15.3
CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
Memory: 289.63 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.3 - /usr/local/opt/node@10/bin/node
Yarn: 1.15.2 - ~/.yarn/bin/yarn
npm: 6.9.0 - /usr/local/opt/node@10/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 28
Build Tools: 28.0.3
System Images: android-29 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5199772
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_192 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.1 => 0.62.1
npmGlobalPackages:
react-native: Not Found
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Preload an image using
Image.prefetch(img) - display the image using
only-if-cached
OR
- Preload an image using
Image.prefetch(img) - display the image
Expected Results
Scenario 1
- Image is shown
Scenario 1
- Image is instantly shown
Snack, code example, screenshot, or link to a repository:
https://snack.expo.io/yseyl0_9N
Activity
[-]Image prefetch does not work on iOs[/-][+]Image prefetch does not work on iOS[/+]darcoola commentedon May 19, 2020
I have the same problem using simulators. It works for Android but not for iOS.
martin-888 commentedon Jun 3, 2020
Just confirming same problem on iOS.
CDBridger commentedon Jun 4, 2020
I am seeing the same, can anyone recommend an alternative library which supports prefetching in the meantime (which is not dead)?
rossjohnsonMP commentedon Jun 4, 2020
@CDBridger I found that react-native-fast-image is broken in the opposite way and seems like its dying so not the best alternative
giaset commentedon Jul 6, 2020
Having the exact same issue on iOS. Prefetching all my images but getting an empty cache when I call
Image.queryCacheObviously, this causes
only-if-cachedto not work eithernhohb commentedon Aug 10, 2020
Same issue on iOS when offline mode
JackClown commentedon Sep 21, 2020
same problem
react-native: 0.59.10
Twinski commentedon Sep 23, 2020
Can confirm this on RN 0.61.4!
Interesting discovery: the Image.queryCache does show images which are smaller in size..
Measured behavior:
Loading large images (eg. Unsplash wallpapers ~1.3MB): no file stored in the fsCachedData folder
Loading normal size images (~200KB): file stored in fsCachedData & appears in Image.queryCache
punjasin commentedon Oct 20, 2020
same here it take sometimes for image to load up even queryCache show that image are already cache
26 remaining items
zhongwuzw commentedon Dec 17, 2024
I made a PR #48309 to try to fix this :)
react-native-bot commentedon Jun 16, 2025
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
nrwinner commentedon Jun 22, 2025
Issue still exists
bglgwyng commentedon Jun 25, 2025
@61people did you find the solution? I tested #48309 but it didn't work.
react-native-bot commentedon Dec 23, 2025
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Navneetkrh commentedon Feb 10, 2026
any updates on this?
react-native-bot commentedon Aug 10, 2026
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
fix(iOS): reuse prefetched images (react#57971)