My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Load image from state (React Native)

mark barton's photo
mark barton
·May 21, 2019

Still quite new to React Native so here we go. I've created a flat list that generates Cards containing data from a JSON file. All the standard text is being displayed, however, file locations for images are not.

For example;

All entries in the JSON file are called an 'item'. The text is displayed inside text containers using something like item.title or item.information.

I am doing the same with an image but no cigar. item.image does return the string from the JSON file, but for some reason, this string doesn't seem to translate to an actual file location as the image is not displayed.

<image source={uri: item.image}}></image>

Any idea why this is? For reference, the file path of the image is '../assets/Images/image.png'

Thanks!