Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native, Unable to resolve module for static image

I'm using react-native 0.14.1

react-native run-android

[3:10:56 PM] <START> find dependencies
Unable to resolve module image!ic_action_android_back_white3 from /Users/lion/Desktop/Developer/AwesomeProject/NewTrackActivity.js
Unable to resolve module image!ic_action_android_back_white3 from /Users/lion/Desktop/Developer/AwesomeProject/NewTrackActivity.js

If I force open my app in Genymotion it can't find my image.

Requiring unknown module image!ic_action_android_back_white3

I'm tried to move image to both ./android/app/src/main/res/drawable-xxx and ./assets/drawable-xxx but neither work.

like image 403
b.ben Avatar asked Dec 08 '15 08:12

b.ben


1 Answers

Have you tried to mount the image, like the new asset manager allows you to do? It's described in the documentation.

Use the following prop for the Image component. Choose the right relative path and dont forget the extension.

<Image source={require('./my-icon.png')} />
like image 150
purii Avatar answered Oct 21 '22 03:10

purii