Auto-scaling Images in React Native

Published

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' }} />;
};