react-native-img-cache icon indicating copy to clipboard operation
react-native-img-cache copied to clipboard

Support source to be given an array

Open mjroeleveld opened this issue 6 years ago • 3 comments

This is useful for e.g. icons (available in multiple sizes) to be displayed and cached.

mjroeleveld avatar Jul 21 '17 14:07 mjroeleveld

I had the same problem. You can use this https://gist.github.com/infostreams/1a848878ba82fdc9ac92e4d61b957c6f instead. Let me know if that works for you!

infostreams avatar Jan 08 '18 15:01 infostreams

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.

mjroeleveld avatar Jan 09 '18 15:01 mjroeleveld

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.

infostreams avatar Jan 10 '18 08:01 infostreams