-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: avoid displaying placeholder when the picture is already in cache #121
Comments
Hi @Elindorath. You’re right, there’s no need to display the placeholder if the image is already cached. We’re currently looking into the best way to handle this case. For the debounce, it helps avoid generating excessive requests when the user resizes their viewport (as shown in the video). That being said, this feature doesn’t make sense for iOS and Android. We’ve modified it in version 0.31.4 of the components. If you test it, you should notice that the previously observed latency is no longer present. Hoping this helps. Regards. |
Thanks a lot!
Just to make sure you had it in mind: there might be a case that make sense, when switching from portrait to landscape mode, and vice versa. We'll update to v0.31.4 during the first half of this week, I'll let you know. |
* Avoids displaying the placeholder if the image is in cache on iOS and Android in React Native. #121 * fix: adds miising CachePolicy validation. * Adapts React-Native lazy-loading to handle cached images. * Adds a debounce function in React-Native to compute ViewportBox on window size change. * Updates CHANGELOG.
Hi @Elindorath. We have just released version 0.32.0 that improves the cache handling: no more placeholder when an image has been cached. We sincerely hope this enhancement will improve your experience and makes image loading more efficient. As always, feel free to provide any feedback or suggestions. Regards. PS: thanks for suggesting this excellent idea! It really helped us improve the TwicPics Components. |
Hello there,
I tested to use expo-image to take advantage of the cache. By doing so, I was expecting to see the placeholder only the first time the pictures are loaded. But this is sadly not the current behaviour, the placeholder is always shown no matter the situation.
If I understand correctly the implementation, the following is occurring:
On mount:
When visible (or eager):
This means that under the best circumstances, the minimum time before we can effectively see the picture is 100ms +
transitionDelay
+transitionDuration
(neglecting the overhead induced by rendering cycles). I don't fully understand why this arbitrary 100ms is present. But I think we could leverage thegetCachePathAsync(cacheKey: string)
method from expo-image (even thequeryCache(urls: string[])
one from react-native'sImage
) to optimize this time depending on the case.What do you think?
I would enjoy to work on a PR but I lack context about implementation design decisions.
The text was updated successfully, but these errors were encountered: