Description
When using dynamically downloaded images (e.g. user avatars fetched from a CDN) as tab-bar or toolbar icons, there is no way to specify the image scale factor. ImageParser delegates to [RCTConvert UIImage:], which defaults to scale = 1.0 for URI-based images. This causes icons to render at their full pixel size on Retina displays instead of the intended logical size.
The standard @2x/@3x filename suffix convention does not apply here because images are downloaded to the cache directory at runtime with arbitrary filenames.
Steps to reproduce
- Download an image to the local filesystem (e.g. a 60×60 px avatar for a 20pt tab icon on a 3x device)
- Pass it as a bottom tab icon:
{ uri: 'file:///path/to/avatar.png' }
- Observe the icon renders at 60×60 points instead of 20×20 points
Expected behavior
Callers should be able to pass an optional scale property in the image source dictionary:
icon: { uri: 'file:///path/to/avatar.png', scale: 3 }
ImageParser would then re-create the UIImage at the requested scale using [UIImage imageWithCGImage:scale:orientation:], so the icon renders at the correct logical size.
Proposed fix
PR #8329 adds this support in a backwards-compatible way — the scale key is only read when explicitly provided.
Environment
- react-native-navigation: 8.8.8
- React Native: 0.85.3
- Platform: iOS
Description
When using dynamically downloaded images (e.g. user avatars fetched from a CDN) as tab-bar or toolbar icons, there is no way to specify the image scale factor.
ImageParserdelegates to[RCTConvert UIImage:], which defaults toscale = 1.0for URI-based images. This causes icons to render at their full pixel size on Retina displays instead of the intended logical size.The standard
@2x/@3xfilename suffix convention does not apply here because images are downloaded to the cache directory at runtime with arbitrary filenames.Steps to reproduce
{ uri: 'file:///path/to/avatar.png' }Expected behavior
Callers should be able to pass an optional
scaleproperty in the image source dictionary:ImageParserwould then re-create theUIImageat the requested scale using[UIImage imageWithCGImage:scale:orientation:], so the icon renders at the correct logical size.Proposed fix
PR #8329 adds this support in a backwards-compatible way — the
scalekey is only read when explicitly provided.Environment