1import { Dimensions } from "react-native";
2const win = Dimensions.get('window');
3
4<Image
5 style={{
6 width: win.width/2,
7 height: win.width/2,
8 resizeMode: "contain",
9 alignSelf: "center",
10 borderWidth: 1,
11 borderRadius: 20,
12 }}
13 source={{uri:'https://facebook.github.io/react/img/logo_og.png'}}
14 resizeMode="stretch"
15/>
1First import Dimensions from react-native
2
3import { Dimensions } from 'react-native';
4then you have to get the dimensions of the window
5
6const win = Dimensions.get('window');
7Now calculate ratio as
8
9const ratio = win.width/541; //541 is actual image width
10now the add style to your image as
11
12imageStyle: {
13 width: win.width,
14 height: 362 * ratio, //362 is actual height of image
15}