简体   繁体   English

图像未在本机反应中呈现(世博会)

[英]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 时图像没有渲染..

<HomeScreenBox
      BoxName="Add Marks"
      BoxImage='require("../assets/images/person.jpg")'
 />
const HomeScreenBox = (props) => {
  return (
    <View>
      <Image source={props.BoxImage} />
      <Text>{props.BoxName}</Text>
    </View>
  );
};

require should not be a string, try BoxImage={require("../assets/images/person.jpg")} require 不应该是一个字符串,试试BoxImage={require("../assets/images/person.jpg")}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM