I have this warning in my project: "Warning: Failed prop type: Invalid prop source
supplied to Image
". I'm loading an image from sampleProducts.json to Recommendend.js and pass it as props in Products.js, but the image won't load because of the warning.
sampleProducts.json
"recommended": {
"product1": {
"id": "1",
"image": "require('../images/sample1.png')",
"name": "Sample Product",
},
Recommmended.js
{Object.values(recommended).map(product => (
<Products
key={ product.id }
productImage={ product.image }
productName={ product.name }
/>
))}
Products.js
<Card style={ styles.card }>
<CardItem>
<Image style={ styles.productImage } source={ productImage} resizeMode='contain' />
</CardItem>
<CardItem>
<Body>
<Text style={ styles.productName }>{productName}</Text>
</Body>
</CardItem>
</Card>