gonglong
gonglong

Reputation: 582

Does react native support loading image according to dpi

Something like drawable-xdpi drawabale-xxdpi in Android and @2x @3x in iOS?

Here is the sample

 <Image
   source={require('./img/3.jpg')}
   resizeMode='cover'/>

Upvotes: 1

Views: 2576

Answers (1)

Burak Karasoy
Burak Karasoy

Reputation: 1690

You can add different sizes of images in a folder. It is similar to ios implementation.

└── img
   ├── [email protected]
   └── [email protected]

usage

<Image source={require('./img/check.png')} />

Packager will bundle and serve the image corresponding to the device's screen density, e.g.

You had better read this page for better understanding. https://facebook.github.io/react-native/docs/images.html

Upvotes: 3

Related Questions