react-native-web icon indicating copy to clipboard operation
react-native-web copied to clipboard

prefer to load @2x image by default for import local images

Open Alexorz opened this issue 3 years ago • 1 comments

For local icon image files like this:

icon.png
[email protected]
[email protected]

And normal usage code in RN Native:

<Image source={require('./assets/icon.png')} />

RN Native will automatically choose a best size for the current device through pixel ratio.

But on the web, the code require('./assets/icon.png') will load the @1x file, it makes the icon be blurred on high resolution screens like Apple retina-display or almost all of smart phones today.

Maybe a better default action is to load the @2x file (should be a webpack job?), this choice will solve the problem and it load less size of files on network than to load both @1x and @2x.

Hope RN-Web to be more easy to use 🙂

Alexorz avatar Oct 29 '21 20:10 Alexorz

https://github.com/peter-jozsa/react-native-web-image-loader

can help you

blackbing avatar Jan 07 '22 06:01 blackbing