0

因此,我在带有 typescript 和 redux 的 react-native 项目中使用 react-navigation,但是当我为抽屉导航器设置 contentComponent 道具时,我在 typescript 中收到此错误。

键入'ConnectedComponentClass<SomeClass>' is not assignable to type 'ComponentType<DrawerItemsProps>' Type 'SomeClass' is missing the following properties from type 'DrawerItemsProps': navigation, items, getLabel, renderIcon, and 2 more.

是否有相同的解决方法。

对此的任何帮助将不胜感激。

4

1 回答 1

0

It seems that the type DrawerItemsProps has properties like navigation, items, getLabel, renderIcon and more and these are missing in your SomeClass interface.

So you can make all these properties which are missing as optional using '?' like below

interface DrawerItemsProps {
  // other properties
  navigation?: yourType,
  items?: yourType, 
  getLabel?: yourType,
  renderIcon?: yourType
}
于 2019-02-08T05:34:50.387 回答