Reputation: 149
I'm working on a mobile app, but when I try to acces my images from a specific uri it won't show them. But it only shows on the computer of my friend and I did the same.
Above the text inside the 3 blocks there should be a image, but I receive an error.
The code:
<Image
style={styles.image}
source={{uri: 'http://10.0.2.2:8000/images/illustrations/' + illustration}}
onError={(error) => console.error(error)}
/>
I don't know what is going wrong ...
Upvotes: 4
Views: 8410
Reputation: 312
I tried pretty much everything until I put width and height, and was like a miracle
Upvotes: 1
Reputation: 516
Maybe try to restart your metro bundle.
<Image source={{ uri: `http://10.0.2.2:8000/images/illustrations/${illustration}`}} style={{ height: 80, width: 80}}
Upvotes: 0
Reputation: 212
You have to must give width for images in react-native. also check the path of image if the path is right just clear your metro bundler cache and restart it.
<Image source={{ uri: 'http://10.0.2.2:8000/images/illustrations' + illustration }} style={{ height: 80, width: 80}} />
Upvotes: 5