Control FlatList scroll position using an animated value #6219
-
Is it possible to control the scroll (speed and position) of a FlatList or ScrollView with Reanimated? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey! Could you specify what do you mean by saying control the scroll speed? Do you mean how quickly the scrolling will end when you release your finger (after scrolling manually)? When it comes to the const aref = useAnimatedRef<Animated.FlatList>()
...
<Animated.FlatList
ref={aref}
...
/> You have to call function scrollList(y: number) {
runOnUI(() => {
scrollTo(aref, 0, y, true)
})()
} |
Beta Was this translation helpful? Give feedback.
In such a case, you can disable the default scroll animation by passing
false
as the lastscrollTo
function parameter. The default animation (whentrue
is passed) cancels the previous one, so you see the only last one when thespeed.value
reaches the target value.I think it should work with your code properly just with this one change.