简体   繁体   中英

How can I resize the images in react native?

I am using logo.png and if width: 50 and height: 50 (see screenshot_1) then only some part of the image is viewable on the entire image. Now if width: 100 and height: 50 (see screenshot_2) the entire image is seen but I want the entire image with small dimensions how can I do that? I tried different values of width and height but doesn't work?

Original image dimensions are: 50 X 26

Screenshot1:

在此处输入图片说明

Screenshot2:

在此处输入图片说明

use a Property called resizeMode:'contain' in the image style and mention your width and height

<Image style={{width:'your_width',height:'your_height',resizeMode:'contain'}} />

Hope that helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM