Image.getSize()

static getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void)

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.

doc_React_Native
2016-06-23 04:24:10
Comments
Leave a Comment

Please login to continue.