How to show local JPG image with React Native?

Viewed 5639

Does RN support local static JPG images? All sample codes here are about PNG images.

I see error "TypeError: unsupported file type" in the packager console. It must be not image location issue, it works if I change image name to test.png. Thanks.

<View>
  <Image source={require('./images/test.jpg')} />
<View>
2 Answers

Others with non-corrupt images might have the issue that they need to add the dimensions to their images (height and width) in order for it to show.

<Image source={require('./images/image1.jpg')} style={{height:30, width:30}} />
Related