feat(ios): add priority support for image loading - #430
Conversation
Add `priority` prop to control image loading priority on iOS using Nuke's ImageRequest.Priority. Supported values: - veryLow - low - normal (default) - high - veryHigh This allows developers to prioritize important images (like hero images) over less important ones (like thumbnails in a long list).
- Move `priority` field from TurboImageProps to Source interface - Update iOS native code to read priority from source dictionary - Add priority support to prefetch method - Remove separate priority prop export from native bridge This makes the API more consistent since headers and cacheKey are already part of source.
|
I didn't find built in priority feature in coil to implement it on android, since I don't have any Android native experience to implement this feature (if it's possible by the way), will appreciate if anyone who experienced more can help and implement it by himself or even give the doc how to design it, maybe I will find the way to do it with LLM Anyway, I think we can merge this PR without android |
duguyihou
left a comment
There was a problem hiding this comment.
Thanks. Would you like to add a new screen to demonstrate it in the example project?
|
|
||
| typealias Source = [String: Any] | ||
|
|
||
| private func parseRequestPriority(from priority: String?) -> ImageRequest.Priority { |
There was a problem hiding this comment.
Can we have a untiliy function or enum to handle this? this function is written twice.
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
|
This PR was closed because it has been stalled for 30 days with no activity. |
Summary
This PR adds support for the
priorityprop on iOS, allowing developers to control image loading priority using Nuke'sImageRequest.Priority.Supported values:
veryLowlownormal(default)highveryHighUse case
This allows developers to prioritize important images (like hero images or above-the-fold content) over less important ones (like thumbnails in a long list that are off-screen).
Usage
Changes
priorityproperty andparseRequestPriority()method to convert string values toImageRequest.Prioritypriorityproperty to React NativePrioritytype andpriorityprop toTurboImagePropsPrioritytypepriorityprop handlingNotes
normalwhen not specified.