diff --git a/docs/image.md b/docs/image.md index 84c0338e64a..d6accacf46d 100644 --- a/docs/image.md +++ b/docs/image.md @@ -464,11 +464,7 @@ Abort prefetch request. ### `getSize()` ```tsx -static getSize( - uri: string, - success: (width: number, height: number) => void, - failure?: (error: any) => void, -): any; +static getSize(uri: string): Promise<{width: number, height: number}>; ``` 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. @@ -477,11 +473,9 @@ In order to retrieve the image dimensions, the image may first need to be loaded **Parameters:** -|
Name
| Type | Description | -| -------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------- | -| uri
Required
| string | The location of the image. | -| success
Required
| function | The function that will be called if the image was successfully found and width and height retrieved. | -| failure | function | The function that will be called if there was an error, such as failing to retrieve the image. | +|
Name
| Type | Description | +| ---------------------------------------------------- | ------ | -------------------------- | +| uri
Required
| string | The location of the image. | --- @@ -490,10 +484,8 @@ In order to retrieve the image dimensions, the image may first need to be loaded ```tsx static getSizeWithHeaders( uri: string, - headers: {[index: string]: string}, - success: (width: number, height: number) => void, - failure?: (error: any) => void, -): any; + headers: {[index: string]: string} +): Promise<{width: number, height: number}>; ``` Retrieve the width and height (in pixels) of an image prior to displaying it with the ability to provide the headers for the request. This method can fail if the image cannot be found, or fails to download. It also does not work for static image resources. @@ -502,12 +494,10 @@ In order to retrieve the image dimensions, the image may first need to be loaded **Parameters:** -|
Name
| Type | Description | -| -------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------- | -| uri
Required
| string | The location of the image. | -| headers
Required
| object | The headers for the request. | -| success
Required
| function | The function that will be called if the image was successfully found and width and height retrieved. | -| failure | function | The function that will be called if there was an error, such as failing to retrieve the image. | +|
Name
| Type | Description | +| -------------------------------------------------------- | ------ | ---------------------------- | +| uri
Required
| string | The location of the image. | +| headers
Required
| object | The headers for the request. | ---