This site runs best with JavaScript enabled.

Auto-scaling Images in React Native


One method to auto-scale images in React Native while preserving aspect ratio:

const imageStyles = {
flex: 1,
width: null,
height: null,
resizeMode: 'contain',
}
const Example = () => {
return (
<Image
style={imageStyles}
source={{ uri: 'https://placeholder.com/850' }}
/>
);
}
Share article