showing results for - "07 customize width and height props with fixed and flex dimensions"
Matilda
26 Nov 2016
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/>
Christian
11 Oct 2016
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}
Laura
30 Sep 2020
1const {width, height} = useWindowDimensions();
2
queries leading to this page
react native define width of imagereact native make image smallerreact native image width height autosize of image react nativechange suze of image react nativeget image width and height react nativeimage height and width set auto react nativereact native make the dimensions of an image smallermake width of image auto react nativeresizemode css react nativeimage resizereact nativeimage height auto react nativedimension foto react nativemake image smaller react nativehow to calculate image width using dimensions in react nativehow to dispay image size auto in react nativemake image bigger react nativereact native image get sizeimage width center size react nativeimage width and height react nativeset image height and width react nativeimage size react native cssauto size image react nativereact native image object fitset the image size in react nativereact native image auto heightget image height and width react nativereact how to set same width and height for imageimage position adjust react nativebest size in react native imageimage dimensions react nativeimage auto size in react nativereact native image dimensionsgiving widh and height to reac native imagehow increase size of image in react nativereact image stretchreact native width auto imageimage heigt react nativereact native image taking 3 times the heightreact native responsive image width and heightreact native image resizemodereact native contain image in viewreact native images resolutionincrease size of image react nativehow become image size react nativerequire image with width height react nativeimage scale react nativeset width and height of image react nativeincrease with of an image in react nativereact native image width heightimage width react nativeimage contain in react native stylesheethow to autofit image based on width in react nativeimage tag size in react nativereact native image heightreact native image size issuehow to fix height and width of image in reactreact native make image stretch to width and heightget image size react nativerender image width 100 25 height auto react nativemake image with 100 height and width react nativeadjust image size react nativeget image size in react nativehow to wide png in react nativereact native increase image sizehow to show scaletype in react native imagehow to make image auto height react nativereact native image scaleresizemode react nativerender image in its original width and height react nativereact native auto image heightreact native image width and heightimage gets cropped when height is defined in react nativeimage with height react nativereact native image height widthimage style height react nativereact native image sizereact native image show orininalincrease image size react nativeimage pixel size in react native imagereact native resize imagewhat image resizemode react nativeset height based on resolution react native iagesize an image in react nativehow to set height and width of image in pixels in react nativeimage full react nativecustomize width and height props with fixed and flex dimensionsreact native image width autoauto height react native imageimage width auto react nativereact native keep size widthreact native set image sizereact native image size autohow to set image size in react nativehow to set whole image in fix height in react nativeheight and width image react nativestyling image in react nativehow to stretch image height to screen in react nativedimensions of image react nativeheight auto for images in react nativedynamically size image reactscale an image in react nativereact native adjustable image width height fixedimage dimension react nativereact native render image in view smallreact native adjust imagehow to use pixels in react native for image width and heightreact native size imagereact native style image sizeimage react native sizeimage width styles react nativereact native image size coverauto in reactreact native control the width and height of an image react nativereact image height width autocreate view of full width and custom height react nativehow to get dimensions of image react nativereact native image fixed heightimage size prop react nativehow to calculate the size of image in react nativeheight auto of image in react nativereact native width auto imageimages scale react nativehow to scale down the image in react nativereact native auto height imagereact native show image biggerchange size of image react nativereact native 100 width height auto imagebackgroundreact native auto width imagereact native image widthcenter image react nativecustomize image in react nativeimage width 100 react nativehandle image size in react nativereact native fixe imgae sizeimage original width react native imagereact make image 50 25 width heightimage size in react nativeimage height and width react nativereact native image resizeauto height width react native imageimage height auto in react nativeimage in react set width heightreact native scale imagereact native image adjust dimensionsimage reszing in react nativereact native set image width and auto heighthow to get image size in react nativescale image react nativereact native auto image widthadjusting size of image in react nativereact native image background auto heightset image in 5 size react nativescale the images in react nativeimg react native sizeget image width and height in react nativereact native get size imagset image width and height react nativehow to make image component smaller react nativehow to make font size dynamic on react nativesize image react nativeimage tag height and width react nativechoosing the right png image size react nativeresizemode image in reacthow to increase only width of image inreactimage size react native image according to dimensions react nativegive height to image according to dimensions react nativehow to style image in react nativehow to set an image height and width react nativereact native size style imagehow to adjust image size in react nativeauto adjust dimension react native imagesgetting size in react native imagereact native image stylesimage width height react nativechange image size in react nativeadapt width to height react native imagereact native image sizehow to get size of image in react nativereact native how to scale an imageset image size in react nativereact native image size guideimage height react nativeimage react native styleimage object fit in react nativewidth of an image in pixels in react nativereact native resize modereact native style img 100 25 widthhow to get size image in react nativereact native image width heighthow to set width of image fill in react jsreact native set image height to fitimage react native width heightget perfect height for react native imagehow to get height and width of an image in pixels in react nativeimage width responsive react nativeheight auto react native imagereact native image width and height valid valuehow to set image according to image size in react native react native change image sizewhich size of image is use in react nativeset image height and width react native without componentreact native get size iamgeget image width react nativereact native scale image 100 widthheight and width of image in react nativehow to set image width and height in react jsset image width and height in react nativereact native set width in dpimage height and width in react nativeresizemode in react nativehow to adjust the height for image in react nativewidth image react nativereact native image containset image size dynamically react nativescaling images react nativecontent resize image in react nativereact native image width 100react native smaller image sizeimage height width react nativescale image in react nativereact native image change sizehow to determine the optimum image size in react nativeimage background react native resizemodeset height based on resolution react native imagereact native image scale up heightset image width 100 25 height auto react nativeimage resizing in react nativeresizemethod react nativecreat view of full width and custom height react nativereact native image height width autohow set height width in image in react react nativeimage height width in 25 react native setting height and width of image in react native react native image scale heightsize property of image in react nativereact native image height 100 25 width autoreact native image height autoreact native href as imageset auto height and width react native imageadjust the size of image component react nativeimage crops in react native on giving width and heightsizing an image in react native07 customize width and height props with fixed and flex dimensionsauto height image react nativereact native image set width to screen widthresize image react nativeimage height in reactimage height in react nativereact images either width or heightreact native style imgreact native image width 100 25height auto image react nativehow to set image width and height in react nativehow to adjust image width in react nativeresize image in react nativechange image size react nativereact native asign width to imagehow to adjust width and height of image in react nativehow to resize image in react nativereact native image set height widthauto height in react native imageimage width 100 25 react nativeimage width and height in react nativeobject fit in react nativereact native image stretchhow to scale image in react native07 customize width and height props with fixed and flex dimensions