我正在使用这个组件:https://github.com/meliorence/react-native-snap-carousel 该组件正在使用 FlatList,因此我可以在其中使用从 FlatList 派生的方法,例如 onEndReached:
import BottomCarousel from 'react-native-snap-carousel';
<BottomCarousel
onEndReached={loadMore} // << This gives a TS error
...
但是,库没有扩展这些方法的打字稿定义,所以我收到错误 Property 'onEndReached' does not exist on type 'IntrinsicAttributes &...
如何在不触及原始组件的情况下将这些 TS 定义包含在我加载到视图中的组件中?
答案 0 :(得分:0)
您是否为图书馆安装了类型?
$ npm install --save @types/react-native-snap-carousel