Reputation: 51
I have root has App.ja which calls Discovery.js screen from screens folder, and Discovery.js has to get image from asset/gallery/image/my.png , i want to know how to write the path the my.png file? I tried this (from inside Discover.js):
let imagePath = require('./././asset/gallery/image/my.png');
project (root)
|
+—screen
| |
| +—Discover.js
|
+—asset
| |
| +—gallery
| |
| +—image
| |
| +—my.png
I got this error:
Unable to resolve module ./././asset/gallery/image/
from screens/Discover.js
:
None of these files exist:
RCTFatal __28-[RCTCxxBridge handleError:]_block_invoke _dispatch_call_block_and_release _dispatch_client_callout _dispatch_main_queue_callback_4CF CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE __CFRunLoopRun CFRunLoopRunSpecific GSEventRunModal UIApplicationMain main start
Upvotes: 1
Views: 1097
Reputation: 48
Change your path to ../../asset/gallery/image/my.png
..
goes back a directory. Not .
.
Upvotes: 1