简体   繁体   中英

react native expo how to require an image?

I'm learning react native expo

I want to require an image from assets/images

在此处输入图片说明

The image I want to require is noti.png

I got this error

在此处输入图片说明

What am i missing?

You are passing the location of the image incorrectly. as you can see in the error: the module .. could not be found

To fix it, check the location of current file you are calling that image then go back to the exact location and call it. Also If you are using IDE they recommend you the location.

Update:

require('../assets/images/noti.png'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM