recyclerlistview
recyclerlistview copied to clipboard
UseScrollToTop in react navigation v5 and RecyclerListView
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 ?
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.
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} ..... /> ) ... }
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.