Reputation: 11079
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>
Upvotes: 3
Views: 7472
Reputation: 337
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}} />
Upvotes: 0
Reputation: 1236
You just need to do :
<Image source={require('./images/image.jpg')} />
If you are calling this lets say in a Folder and the Folder images is not there you need to do require('../images/image.jpg')
and check if the image is really jpg if you want to see the extension of the image:
And check then the extension of the file if its not jpg and its png just use .png and it works.
Upvotes: 2