Skip to content

feat(ios): add priority support for image loading - #430

Closed
Navipro70 wants to merge 4 commits into
duguyihou:mainfrom
Navipro70:feat/ios-priority-support
Closed

feat(ios): add priority support for image loading#430
Navipro70 wants to merge 4 commits into
duguyihou:mainfrom
Navipro70:feat/ios-priority-support

Conversation

@Navipro70

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for the priority prop on iOS, allowing developers to control image loading priority using Nuke's ImageRequest.Priority.

Supported values:

  • veryLow
  • low
  • normal (default)
  • high
  • veryHigh

Use 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

import TurboImage, { Priority } from 'react-native-turbo-image';

// High priority for hero image
<TurboImage 
  source={{ uri: 'https://example.com/hero.jpg' }}
  priority="high"
/>

// Low priority for thumbnails in a list
<TurboImage 
  source={{ uri: 'https://example.com/thumbnail.jpg' }}
  priority="low"
/>

Changes

  • ios/TurboImageView.swift: Added priority property and parseRequestPriority() method to convert string values to ImageRequest.Priority
  • ios/TurboImageViewManager.m: Exported the priority property to React Native
  • src/types.ts: Added Priority type and priority prop to TurboImageProps
  • src/index.tsx: Exported Priority type
  • src/TurboImage.tsx: Added priority prop handling

Notes

  • This is iOS-only for now. Android support could be added in a future PR using Glide's priority system.
  • Default priority is normal when not specified.

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.
@Navipro70

Navipro70 commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

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 duguyihou left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a untiliy function or enum to handle this? this function is written twice.

@github-actions

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the Stale label Mar 26, 2026
@github-actions

Copy link
Copy Markdown

This PR was closed because it has been stalled for 30 days with no activity.

@github-actions github-actions Bot closed this Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants