【发布时间】:2017-07-10 18:09:29
【问题描述】:
我正在尝试将图像源和标题作为道具发送到 React Native 中的定制无状态组件。 (图片来源和标题)
props.imageSource 行导致错误,感谢任何帮助。这是有问题的代码:
const MainPageButton = (props) => {
var imageSource = require({props.imageSource});
return (
<TouchableOpacity>
<Image source={imageSource} />
<Text>{props.title}</Text>
</TouchableOpacity>
)
}
【问题讨论】:
标签: properties react-native components