Im trying to scroll to the middle of my data in flatlist using React Hooks and the method scrollToIndex but i cant make reference to it. I achieved that with class using something like ref={component => (this.list = component)} but i can reached with useRef.
const refContainer = useRef(null);
useEffect(()=>{
if(refContainer){
refContainer.scrollToIndex({ animated: true, index: 0 });
}
},[status])
<FlatList
ref={()=>refContainer}
refreshing={loading}
onRefresh={() => console.log('refreshing')}
keyExtractor={(item, index) => item.date}
showsVerticalScrollIndicator={false}
style={{flex: 1,}}
data={kits}
onEndThreshold={0}
renderItem={({item, index}) => renderItem(item, index)}
/>
shows me the error: refContainer.scrollToINdex is not a function.