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

Type 'ListRenderItem' is not assignable to type 'ListRenderItem

$
0
0

why I get this error:

Type 'ListRenderItem<IPhotos>' is not assignable to type 'ListRenderItem<unknown> 

Code:

import { Dimensions, Image, ListRenderItem, Pressable, StyleSheet, Text, View } from 'react-native'import React from 'react'import { IImageSlider } from './Model'import { FlatList } from 'react-native-gesture-handler'import { IPhotos } from '../Product'import Animated from 'react-native-reanimated'const { width } = Dimensions.get('window');const AnimatedFlatlist = Animated.createAnimatedComponent(FlatList);const ImageSlider = ({ photos }: IImageSlider) => {  const renderItem: ListRenderItem<IPhotos> = ({ item }) => {    return (<Pressable><Image source={{uri: item.photo}} style={s.image} resizeMode='contain' /></Pressable>    )  };  return (<AnimatedFlatlist      data={photos}      renderItem={renderItem}      keyExtractor={(item) => item.image_id}      pagingEnabled      horizontal      style={s.flatList}    />  )}

What I am doing wrong ? If I replace animated flatlist with flatlist then it works but I have to use the Animated. Can anyone help me to solve this ts error ?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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