DylanVann / react-native-fast-image

🚩 FastImage, performant React Native image component.
MIT License
8.1k stars 1.48k forks source link

Low quality of vertical (portrait) images! #887

Open Omelyan opened 2 years ago

Omelyan commented 2 years ago

Describe the bug Vertical images are rendered at low resolution in horizontal container when loaded from cache. At the same time, everything is ok when filling the vertical container. This problem has been around for a long time. See #658, #545, #850... An image display component that cannot properly display an image. Hey!

Screenshots

<FastImage
  source={{ uri }}
  resizeMode={FastImage.resizeMode.cover}
  style={{ height: 160, width: 320 }}
/>

image


<FastImage
  source={{ uri }}
  resizeMode={FastImage.resizeMode.cover}
  style={{ height: 500, width: 320 }}
/>

image

Dependency versions

xiaowl commented 2 years ago

@Omelyan I believe this issue is caused by that the order of property updates is RANDOM as RN using Maps to pass properties. soruce always being set before resizeMode, then Glide will using FIT_CENTER to loading and later the ImageView using CENTER_CROP to display.

Workaround I used:

const [uri, setUri] = useState('');
useEffect(() => {
    setUri(item.uri);
}, []);

<FastImage
  source={{uri: uri}}
  ....
/>
Omelyan commented 2 years ago

@xiaowl that's great, but I'm talking about an image displaying component that can't display a vertical image properly, and this issue has been around for years. Maybe it should be renamed to FastHorizontalImage..?

xiaowl commented 2 years ago

Maybe I can make a pull request trying to fix this isse.

bodrius commented 1 year ago

same issue

apapalillo commented 1 year ago

I have exactly the same issue

AlanWen2016 commented 1 year ago

same issue

pierroo commented 1 year ago

By any chance, is that "displaying image component" react-native-lightbox-v2 @Omelyan ? I am facing the same issue with this library when it contains a fastImage, and for some reason when I close the ligthbox view, re-open it right away: then the image is no longer "low quality looking". Magic.