Skip to content

Use styled-components + ReactNative's FlatList in TypeScript

acro5piano profile image Kay Gosho twitter logo github logo ・1 min read  

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;

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

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



twitter logo DISCUSS (10)
markdown guide
Classic DEV Post from Jul 26 '19

🎩 JavaScript Enhanced Scss mixins! 🎩 concepts explained

In the next post we are going to explore CSS @apply to supercharge what we talk about here....

Kay Gosho profile image
A Full Stack Developer.