小编Jul*_*ert的帖子

React Native FlatList、样式化组件和 Typescript

我与 styled-components 、 FlatList 和 typescript 进行了一场历史性的持续战斗......到目前为止,我已经能够使其与以下内容一起工作:

const StyledList = styled(FlatList as new () => FlatList<ItemType>)<CustomProps>(props => ({
  .......
}));
Run Code Online (Sandbox Code Playgroud)

这种方法工作得很好,直到我最近进行了一次项目升级,它打破了这种方法。我现在有以下依赖版本:

"typescript": "~4.3.5"

"styled-components": "^5.3.3"

"react-native": "0.64.3"

错误是这样的:

Property 'data' does not exist on type 'IntrinsicAttributes & { ref?: Ref<FlatList< ItemType >> | undefined; key?: Key | null | undefined; } & { theme?: DefaultTheme | undefined; } & { ...; } & { ...; }'.
Run Code Online (Sandbox Code Playgroud)

有人可以提供对此的任何见解吗?最新版本中可能发生了哪些更改styled-componentsreact-native阻止了原始解决方法的工作?

typescript react-native styled-components react-native-flatlist

5
推荐指数
1
解决办法
782
查看次数