Use styled-components + ReactNative's FlatList in TypeScript

Kay Gosho - May 30 '19 - - Dev Community

To use styled-components + FlatList, we have to write like this:

interface User {
  id: number
  name: string
}

const StyledFlatList = styled(FlatList as new () => FlatList<User>)`
  background-color: #f7f7f7;
`
Enter fullscreen mode Exit fullscreen mode

[edited]
Finally, I added my workaround. I hope someone solve the issue.

https://github.com/styled-components/styled-components/issues/1803#issuecomment-497323287
[/edited]

This is because styled.FlatList does not support by typing definition of styled-components.

see: https://github.com/styled-components/styled-components/issues/1294

Ref: https://github.com/styled-components/styled-components/issues/1803#issuecomment-407332173

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player