alphasp / pxview

An unofficial Pixiv app client for Android and iOS, built with React Native.
MIT License
751 stars 85 forks source link

PXCacheImage is not using cache #9

Open ITJesse opened 6 years ago

ITJesse commented 6 years ago

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

alphasp commented 6 years ago

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.

ITJesse commented 6 years ago

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.