This prop can also contain several remote URLs, specified together with their width and height and potentially with scale/other URI arguments. The image source (either a remote URL or a local file resource). If the image is larger than the view, scale it down uniformly so that it is contained in the view.Įnum( 'cover', 'contain', 'stretch', 'repeat', 'center') The image will keep its size and aspect ratio, unless it is larger than the view, in which case it will be scaled down uniformly so that it is contained in the view.Ĭenter: Center the image in the view along both dimensions.
Repeat: Repeat the image to cover the frame of the view. Stretch: Scale width and height independently, This may change the aspect ratio of the src.
Defaults to cover.Ĭover: 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).Ĭontain: 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).
#React image resize how to
Typeĭetermines how to resize the image when the frame doesn't match the raw image dimensions. More details about resize and scale can be found at. It should also be used if the image is slightly bigger than the view. This should be used if the image is smaller than the view. Compared to resize, scale is faster (usually hardware accelerated) and produces higher quality images. Scale: The image gets drawn downscaled or upscaled.
This should be used instead of scale when the image is much larger than the view. Resize: A software operation which changes the encoded image in memory before it gets decoded. Defaults to auto.Īuto: Use heuristics to pick between resize and scale. The mechanism that should be used to resize the image when the image's dimensions differ from the image view's dimensions.