Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

Property 'scrollToIndex' does not exist on type 'FlatList'

$
0
0

I'd like to understand the reason for this warning/error: 'Property 'scrollToIndex' does not exist on type 'FlatList<School>'

I have a React Native Snap Carousel list that should be scrolling another list on snap.

I created a ref for the list that I want to scroll with const schoolList = useRef<FlatList<School>>(null);The assigned the ref to that list with ref={schoolList}And my carousel does this:

<BottomCarousel  ...  onSnapToItem={(index) => {    schoolList.current?.scrollToIndex({ animated: false, index });  }}/>

The error I get is on this line: schoolList.current?.scrollToIndex({ animated: false, index });

So I did some digging. scrollToIndexdefinitely exists for FlatList.What am I missing?


Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>