I have a component with a FlatList
which I'm trying to render a View
with an Image
component inside. But the typescript compiler is blaming the error below.
The component
const DummyComponent = ({ dummyArrayOfObjs }): JSX.Element => { return (<FlatList horizontal keyExtractor={(item) => item.id + Math.random() * 16} data={stories} renderItem={({ item }) => { if (item.data.length === 0) { return null } return (<View><Image source={{ uri: item.data[0].uri }} style={{ height: "100%", width: wp(60) }} /></View> ) }} /> )}
The error is:
No overload matches this call. Overload 1 of 2, '(props: ViewProps | Readonly<ViewProps>): View', gave the following error. Type '{ children: Element; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps>'. Overload 2 of 2, '(props: ViewProps, context: any): View', gave the following error. Type '{ children: Element; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps>'.ts(2769)
The code is compiling and working file but the problem is the error, I just wanted to learn why I'm seeing this error here.