Reputation: 23
I am created a simple box component which takes image source as props. But while calling HomeScreenBox the image is not rendering..
<HomeScreenBox
BoxName="Add Marks"
BoxImage='require("../assets/images/person.jpg")'
/>
const HomeScreenBox = (props) => {
return (
<View>
<Image source={props.BoxImage} />
<Text>{props.BoxName}</Text>
</View>
);
};
Upvotes: 1
Views: 152
Reputation: 772
require should not be a string, try
BoxImage={require("../assets/images/person.jpg")}
Upvotes: 2