ascoders / react-native-image-viewer

🚀 tiny & fast lib for react native image viewer pan and zoom
MIT License
2.44k stars 577 forks source link

Not working with images requiring headers #412

Open Alb93 opened 4 years ago

Alb93 commented 4 years ago

Hi, imagine you have an image which needs auth headers to be downloaded.

Because you are trying to get the image size from the url with Image.getSize, this fails and the image is not showed. You can have a look to Image.getSizeWithHeaders to allow fetching the sizes in this common use case.

Same can be said for Image.prefetch, but here it seems that RN does not yet support something like Image.prefetchWithHeaders.

Currently the only workaround I've found is to disable preload and provide width and height ahead of time.

PaitoAnderson commented 4 years ago

Does this help?

https://github.com/ascoders/react-native-image-viewer/issues/169

Alb93 commented 4 years ago

Nope. As you have written there, Image.getSizeWithHeaders should be used and to support also preload a similar prefetch method should be used (and maybe created too)