Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

FlatList: What are the properties of ListRenderItemInfo?

$
0
0

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 vehicleslooks like this:

[{numberPlate: "OL-AL-1336", __typename: "Vehicle"}]

and the component VehicleContainerlooks 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?


Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>