I have a component that scrolls a React Native FlatList:
<BottomCarousel ... onSnapToItem={(index) => { myList.current?.scrollToIndex({ animated: false, index }); }}/>
myList
is a FlatList
which is referenced with useRef
:
const myList = useRef<FlatList<SomeList>>(null);
And I define the type of the list with:
type SomeList = { id: string; name: string; ...
Nothing special here. It all works, but I get a TypeScript warning/error:
Property 'scrollToIndex' does not exist on type 'FlatList<SomeList>'.
Any ideas why? What am I doing wrong here?