Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatlist Generics #61

Closed
martinjuhasz opened this issue Dec 17, 2020 · 3 comments
Closed

Flatlist Generics #61

martinjuhasz opened this issue Dec 17, 2020 · 3 comments

Comments

@martinjuhasz
Copy link

Hey,

i'm trying to use dripsys FlatList with Typescript. The following is typed correctly when importing FlatList from react-native but not from dripsy itself:

<FlatList
  data={stacks}
  renderItem={({ item }: { item: Stack }) => (
    <></>
  )}
  keyExtractor={(item: Stack) => item.id}
/>

Type '(item: Stack) => string' is not assignable to type '(item: unknown, index: number) => string'.

The problem seems to be that dripsies FlatList is explicitly declared with a generic unknown. Is there anything i'm missing tho?

@nandorojo
Copy link
Owner

#58 for discussion

@nandorojo
Copy link
Owner

Do you still see this on version 1.4.6?

@nandorojo
Copy link
Owner

nandorojo commented Dec 23, 2020

Ah, sorry, it's working for me because I'm explicitly typing in renderItem. Ignore that question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants