Can someone assist with resolving this error I'm encountering:
Type 'ListRenderItem<IPhotos>' is not assignable to type 'ListRenderItem<unknown>
Here is the code snippet:
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}
/>
)
}
I'm facing an issue where using animated flatlist triggers a TypeScript error. When I switch back to using flatlist, it works fine, but I really need to make use of the Animated component. Any suggestions on how to tackle this TypeScript error?