Dinesh Kuniyal
Dinesh Kuniyal

Reputation: 23

Image not rendering in react native (Expo)

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

Answers (1)

Ryan Soderberg
Ryan Soderberg

Reputation: 772

require should not be a string, try BoxImage={require("../assets/images/person.jpg")}

Upvotes: 2

Related Questions