pxview icon indicating copy to clipboard operation
pxview copied to clipboard

PXCacheImage is not using cache

Open ITJesse opened this issue 7 years ago • 2 comments

https://github.com/alphasp/pxview/blob/6e7cc473746ea0fd07e906d2757200cd788674f6/src/components/PXCacheImage.js#L71

I see you download the image into the cache folder, and then calculate the size, finally using the origin uri in the Image component. Which means we have the image downloaded twice.

I'm not sure if this is a typo...

ITJesse avatar Nov 21 '17 18:11 ITJesse

In this component, react-native-fetch-blob is use to download images and get images size because the react native Image getSize method is not supporting passing custom HTTP headers.

Images size is required to fit images in Illust Detail nicely.

The reason that I render Image with the source uri instead of the downloaded image path is because the performance is bad and images sometimes getting stuck when rendering.

alphasp avatar Nov 22 '17 06:11 alphasp

I have implemented a simple cache for PXCacheImage component like this: /src/components/PXCacheImage.js

And I cannot comfirm the performance issue you said, it works well. Maybe you should upgrade the react-native to 0.50.3.

ITJesse avatar Nov 22 '17 12:11 ITJesse