Determines how to resize the image when the frame doesn't match the raw
image dimensions.
-`cover`: Scale the image uniformly (maintain the image's aspect ratio)
so that both dimensions (width and height) of the image will be equal
to or larger than the corresponding dimension of the view (minus padding).
-`contain`: Scale the image uniformly (maintain the image's aspect ratio)
so that both dimensions (width and height) of the image will be equal to
or less than the corresponding dimension of the view (minus padding).
-`stretch`: Scale width and height independently, This may change the
aspect ratio of the src.
-`repeat`: Repeat the image to cover the frame of the view. The
image will keep it's size and aspect ratio. (iOS only)
| Type | Required |
| - | - |
| enum('cover', 'contain', 'stretch', 'repeat', 'center') | No |
---
### `source`
The image source (either a remote URL or a local file resource).
This prop can also contain several remote URLs, specified together with
their width and height and potentially with scale/other URI arguments.
The native side will then choose the best `uri` to display based on the
measured size of the image container. A `cache` property can be added to
control how networked request interacts with the local cache.
The currently supported formats are `png`, `jpg`, `jpeg`, `bmp`, `gif`,
`webp` (Android only), `psd` (iOS only).
| Type | Required |
| - | - |
| ImageSourcePropType | No |
---
### `onError`
Invoked on load error with `{nativeEvent: {error}}`.
| Type | Required |
| - | - |
| function | No |
---
### `testID`
A unique identifier for this element to be used in UI Automation
testing scripts.
| Type | Required |
| - | - |
| string | No |
---
### `resizeMethod`
The mechanism that should be used to resize the image when the image's dimensions
differ from the image view's dimensions. Defaults to `auto`.
-`auto`: Use heuristics to pick between `resize` and `scale`.
-`resize`: A software operation which changes the encoded image in memory before it
gets decoded. This should be used instead of `scale` when the image is much larger
than the view.
-`scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is
faster (usually hardware accelerated) and produces higher quality images. This
should be used if the image is smaller than the view. It should also be used if the
image is slightly bigger than the view.
More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html.
| Type | Required | Platform |
| - | - | - |
| enum('auto', 'resize', 'scale') | No | Android |
---
### `accessibilityLabel`
The text that's read by the screen reader when the user interacts with
the image.
| Type | Required | Platform |
| - | - | - |
| node | No | iOS |
---
### `accessible`
When true, indicates the image is an accessibility element.
| Type | Required | Platform |
| - | - | - |
| bool | No | iOS |
---
### `capInsets`
When the image is resized, the corners of the size specified
by `capInsets` will stay a fixed size, but the center content and borders
of the image will be stretched. This is useful for creating resizable
rounded buttons, shadows, and other resizable assets. More info in the
[official Apple documentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/index.html#//apple_ref/occ/instm/UIImage/resizableImageWithCapInsets).
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.