Skip to main content


Ignite's AutoImage Component is an enhanced version of the built-in React Native Image component. It automatically resizes the image view to fit a max width or height constraint

source={{ uri: "" }}

AutoImage uses a useAutoImage hook to calculate the image's dimensions when you have a specific values you need to constrain the image within. This hook is also available for use in your own components.

const { width, height } = useAutoImage(uri, maxWidth, maxHeight)


Ignite's AutoImage component has two props of its own: maxWidth and maxHeight.

maxWidth and maxHeight

These props are used to constrain the image to a specific size. Use maxWidth or maxHeight to set the maximum width or height of the image, and it will resize to whichever dimension you specify without skewing the aspect ratio. e.g. If the image is 300w x 200h, and you set maxWidth={200}, the image will be resized to 200w x 133h.

source={{ uri: "" }}

Default Image props

As AutoImage is a wrapper around React Native's Image component, it also accepts all of the props that Image accepts. See the React Native Image documentation for more information.


As with React Native's built in Image component, the source prop is always required. This can be almost anything that conforms to ReactNative's ImageSource type. (See Notes below for caveats.)

<AutoImage source={logoIgnite} />


Setting the style prop will override the default styles. With AutoImage, you generally only need to specify width or height with dynamically loaded images. Setting both will override the resizing of AutoImage altogether, and if that is needed it's best to just use the default React Native Image component.

<AutoImage source={logoIgnite} style={{ width: 200 }} />
<AutoImage source={logoIgnite} style={{ height: 200 }} />


As noted above, the source prop can be almost anything, the one exception being an array of objects, which AutoImage doesn't support. See the React Native Image#source documentation for more information.