在我看来,我正确定义了这些变量,但我收到了错误format, filetype, filesize, height, and width。错误是“ ReferenceError: {variable name} is not defined”。名称和位置不会出现此问题,它只会影响变量format以及随后在对象中声明的所有其他变量meta。
我正在尝试构建一个组件并传递道具。以下是相关代码片段:
AdminGalleryTile.propTypes = {
onPress: func,
onSelectPress: func,
selected: bool,
meta: shape({
name: string,
location: string,
format: string,
filetype: string,
filesize: number,
height: number,
width: number,
}),
};
export default function AdminGalleryTile({
onPress = () => {},
onSelectPress = () => {},
selected,
style,
source,
meta = {name, location, format, filetype, filesize, height, width},
}) {
return (...);}
<AdminGalleryTile
style={style.GalleryTile}
source={item.uri}
name="Do I look like I know what a jpeg is?"
location="Hank Hill"
format="image"
filetype="JPG"
filesize="420 kb"
height="1080"
width="1920"
selected={selection.find((s) => s.uri === item.uri)}
onSelectPress={() => toggleSelect(item)}
/>
有只小跳蛙
红糖糍粑
相关分类