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

Typescript Error with React Native Flat List

$
0
0

I am getting the following error when trying to use Typescript with a React Native Flat List:

Type '(item: navigationTypes) => JSX.Element' is not assignable to type 'ListRenderItem<unknown>'.

Here is my code:

type navigationTypes = {  name: string  href: string}const navigation = [  { name: 'Support', href: '/support' },  { name: 'Privacy Policy', href: '/privacy-policy' },  { name: 'Terms Of Use', href: '/terms-of-use' },  { name: 'Terms & Conditions', href: '/terms-&-conditions' },]  const Item = ({ title = '', href = '' }) => (<View><Text><TextLink href={href}>{title}</TextLink></Text></View>  )<View><FlatList            horizontal            data={navigation}            renderItem={renderItem}            keyExtractor={(item) => item.id}          /></View>

I'm new to Typescript so I'm struggling to understand why there is an issue here.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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