DEV Community

skptricks
skptricks

Posted on

React Native Get Remote Image Dimensions Android IOS

Source : React Native Get Remote Image Dimensions Android IOS

This tutorial explain how to get remote image dimensions in height and width in react native application. React native Image component provides a method named as getSize which is used to get remote image dimensions in width and height.

getSize() function of Image Component In React Native :
Retrieve the width and height (in pixels) of an image prior to displaying it. This method can fail if the image cannot be found, or fails to download. In order to retrieve the image dimensions, the image may first need to be loaded or downloaded, after which it will be cached. This means that in principle you could use this method to preload images, however it is not optimized for that purpose, and may in future be implemented in a way that does not fully load/download the image data. A proper, supported way to preload images will be provided as a separate API.

Click here to read more...

Top comments (0)