Home > database >  Image not rendering in react native (Expo)
Image not rendering in react native (Expo)

Time:12-22

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>
  );
};

CodePudding user response:

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

  • Related