Reputation: 393
Hi all I'm new to react native and unable to display images from different folder. Here is my image file structure.
src/images/bell.png
src/images/images.js
images.js
export const NOTIFICATION_ICON = require('./bell.png');
The file structure of the component I'm using this image
src/components/common/AppHeader.js
My AppHeader.js file
import { NOTIFICATION_ICON } from "../../images/images";
return(
<Image source={NOTIFICATION_ICON} />
);
I'm getting the following error.
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
Can somebody please help?
Upvotes: 0
Views: 48
Reputation: 2525
remove curly braces and try
import NOTIFICATION_ICON from "../../images/images";
Upvotes: 1