Trying to set up scrollToIndex on a flatlist with typescript on expo but getting an error I don't really understand.I was following the example snack https://snack.expo.io/@s2gt05/flatlist-scrolltoindex-practical-example.-
Below is the flatlist that I have now
<FlatList data={data} ref={(ref) => {if (ref) {this.flatListRef = ref }}} renderItem={({ item, index }) => (<TouchableOpacity onPress={() => onSelect(index)}><Text>{item.title}</Text></TouchableOpacity> )} /> const categorySelector = (index) => { if (this.flatListRef) { this.flatListRef.scrollToIndex({index: index}) } }