recyclerlistview icon indicating copy to clipboard operation
recyclerlistview copied to clipboard

UseScrollToTop in react navigation v5 and RecyclerListView

Open siddharth-kt opened this issue 4 years ago • 3 comments

I use useScrollToTop() in react navigation v5 with recyclerlistview. I am facing 2 issues with it.

  • RecyclerListView scroll to top without animation.
  • Scroll to top event only happens when the RecyclerListView is not moving. If RecyclerListView is moving ("being scrolled or scrolling") then this event does not take place.

any solution ?

siddharth-kt avatar Jul 23 '21 10:07 siddharth-kt

Can you please show your code? Im using a reanimated scrollView as my externalScrollView. i'm not sure how to even get useScrollToTop to function. So any help would be appreciated guys.

haibert avatar Sep 28 '21 15:09 haibert

Ok, my code is something like below :

import {useScrollToTop} from '@react-navigation/native'; ...

function Home(props) { const scrollRef = useRef(null); useScrollToTop(scrollRef);

return ( <RecyclerListView ref={scrollRef} ..... /> ) ... }

siddharth-kt avatar Sep 28 '21 17:09 siddharth-kt

I was able to get it to work. My issue was I was using the same ref for two different RecylerListViews. I hope you found a solution for your issue.

haibert avatar Sep 28 '21 18:09 haibert