imagereact-nativepixel-ratio

How to use android images for different pixel ratio in android? What should I use for hdpi images I can't use imageName@1.5x?


I have 5 images from designer mdpi, hdpi, xhdpi, xxhdpi and xxxhpdi as I found out that in React Native i can only give

  1. check.png
  2. check@2x.png
  3. check@3x.png

I have read Image sizes for android and iOS in react-native but i don't how to provide hdpi(1.5x) and xxxhdpi(3.5x) images?


Solution

  • We simply don't need the intermediate ratio assets while working with React Native, 2x and 3x works very well for hdpi>= requirements. Technically speaking, when you bundle the RN project in Android or when it gets bundled while building, you will be able to see autogenerated transformed image assets in android/app/src/res/drawable which are required for the app to render on target screen resolutions. I would recommend observing those auto-generated assets after building the bundle, you will have fruitful insights about the asset distribution and usage.