I'm trying to set an icon in Android with react-native. My code looks like this:
<ToolbarAndroid
actions={[]}
navIcon={require('image!test')}
onIconClicked={navigationOperations.pop}
style={styles.toolbar}
titleColor="white"
title={route.event.title} />
I've got a non-corrupt test.png file under app/src/main/res/mipmap-hdpi/test.png (after adding the image I've run react-native run-android) and I'm getting a Resource ID #0x0 :

However, if I change the image name to something bogus, the error
"Requiring unknown module "image!testttt". If you are sure the module is there, try restarting the packager"
I don't know what's going on, I've seen an exact example of this in react-native Movies example, that actually works in my computer.
I found what was happening. When I created my project react-native created mipmap directories: mipmap-hdpi, mipmap-mdpi, etc.
These directories in Android are for icons only. I deleted these directories and created drawable ones and put my icon application inside drawable. I adjusted my AndroidManifest to point to @drawable/icon. After this a rebuild the android application and relaunch the packager. It started working right after that with react-native 0.11.0
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