0

I am working with RecylerListView because I have a large list. I want to useAnimatedRef from react-native-reanimated2 to enable synchronous ScrollTo actions. However, when I add it as a Ref, it doesn't work and tells me that ScrollTo is not defined.

 const animatedRecyclerRef = useAnimatedRef()


if(animatedRecyclerRef?.current){
       animatedRecyclerRef.current.scrollTo({ x:0, y:200 });
}

<RecyclerListView
        ref={animatedRecyclerRef}
        rowRenderer={rowRenderer}
        dataProvider={dataProvider}
        layoutProvider={layoutProvider}
/>

dan_boy
  • 1,735
  • 4
  • 19
  • 50

1 Answers1

0

You can pass your own scrollview to recyclerlistview using externalScrollView prop. You should be able to grab a ref to that instead.

naqvitalha
  • 793
  • 5
  • 9