I'm trying to use a FlatList like this:
<FlatList data={vehicles} horizontal={false} scrollEnabled renderItem={({ vehicle}) => <VehicleContainer vehicle={vehicle} />} keyExtractor={(vehicle: any) => vehicle.numberPlate.toString()} />
where vehicles
looks like this:
[{numberPlate: "OL-AL-1336", __typename: "Vehicle"}]
and the component VehicleContainer
looks like this:
type VehicleContainerProps = { vehicle: Vehicle;};export const VehicleContainer: React.FunctionComponent<VehicleContainerProps> = ({ vehicle,}) => { if (!vehicle) { return null; } return (<View style={styles.vehicleInfo}><Text style={styles.numberPlate}>{vehicle.numberPlate}</Text></View> );};
But I keep getting an error on renderItem's vehicle that Property 'vehicle' does not exist on type 'ListRenderItemInfo<Vehicle>'
What is ListRenderItemInfo
? It's not something I have defined myself. How can I fix this?