Categories
React Answers

How to fix the “Invalid prop ‘source’ supplied to Image” error with React-Native Image?

Spread the love

To fix the "Invalid prop ‘source’ supplied to Image" error with React-Native Image, we set the source prop of the Image component to the value returned by calling require with the image path.

For instance, we add the Image by writing

<Image source={require("./my-icon.png")} />;

We set the source to the value returned by require to add the image at my-icon.png.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *