类型“IntrinsicAttributes & Props & { children?: ReactNode;”上不存在属性“customerCode” }'

时间:2021-04-17 20:29:00

标签: typescript react-native

嘿伙计们,我从打字稿中收到此错误:Property does not exist on type 'IntrinsicAttributes & { children?: ReactNode; }' 我导出了一个名为 iCustomer 的默认接口,我可以在我的整个项目中使用它。但是现在我在 CustomerViewList 上导入了它,因为我在输入道具时懒得重复自己。

之后我想导入视图并在我的平面列表中使用它,现在有点收到这个错误。

enter image description here

1 个答案:

答案 0 :(得分:1)

Typescript 告诉您 CustomerViewList 没有名为“customerCode”的道具。看起来您已经定义了两个 props,customeronPress

你应该能够写 renderItem={({item}) => <CustomerViewList customer={item} onPress={onPress} /> }