react-native-img-cache
react-native-img-cache copied to clipboard
Support source to be given an array
This is useful for e.g. icons (available in multiple sizes) to be displayed and cached.
I had the same problem. You can use this https://gist.github.com/infostreams/1a848878ba82fdc9ac92e4d61b957c6f instead. Let me know if that works for you!
I think this addresses something else then what I intended :). The RN Image component can be supplied with an array. It will then automatically find the best match based on your screen density. It would be nice if this library can implement the same behaviour.
I agree that it would be nice if this library supports that behavior. What the code in my gist does is very similar though - it renders the (cached) image that is closest in size to the dimensions you provide. Suits my purposes for the moment, but have to admit I didn't consider screen density. As it stands it just looks at the provided sizes and does a straight up comparison.