I have this
<Image style={styles.image} source={require('image!logo')}/>
Where the logo.png is added to android/app/src/main/res folder.
But the image is not getting displayed(I have re-run react-native run-android).
Do i need to do some other changes?
Note that using <Image source={{uri: http://path/to/image}}/> works.
The image file needs to go in the appropriate drawable-xxx folder under res.
Try putting logo.png
in android/app/src/main/res/drawable-hdpi
and then rebuilding your app.
There's some information on the React Native site: https://facebook.github.io/react-native/docs/image.html#adding-static-resources-to-your-android-app
After adding images you probably need to 'hard restart' the project. Just reloading the JS probably won't show the image.
Since React Native 0.14, you can require images just like requiring JS files.
<Image source={require('./img/check.png')} />
Did you try to give your image some height?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With