fun joker
fun joker

Reputation: 1727

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:

enter image description here

Screenshot2:

enter image description here

Upvotes: 0

Views: 78

Answers (1)

Nightraiser
Nightraiser

Reputation: 309

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

Upvotes: 2

Related Questions