Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onMomentumEnd function not firing in Animated FlashList on Android when using ref.current.scrollToIndex #6605

Open
DOPAgyeman opened this issue Oct 17, 2024 · 6 comments
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided

Comments

@DOPAgyeman
Copy link

DOPAgyeman commented Oct 17, 2024

Description

This issue is still occurring as mentioned by @tomekzaw in a previous issue. The 'onMomentumEnd' function fires with a drag move, but not when scrolling using a ref (e.g ref.current.scrollToIndex)

Is there any workaround for this?

          @tomekzaw I tried your approach, and it does fix the issue only when the scroll is made with a drag move. However, it doesn't trigger when I scroll via `scrollToOffset`.

Originally posted by @hirbod in #3948 (comment)

Steps to reproduce

  • Create an Animated Flash List using Animated.component
  • Add 'useAnimatedScrollHandler' to onScroll of FlashList, and use the 'onMomentumEnd' function
  • Use ref.current.scrollToIndex to programmatically scroll

Snack or a link to a repository

https://snack.expo.dev/@kofiagyeman/onmomentumend-issue

Reanimated version

3.15.0

React Native version

0.74.5

Platforms

Android

@github-actions github-actions bot added Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided and removed Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario labels Oct 17, 2024
@DOPAgyeman DOPAgyeman changed the title onMomentumEnd function not firing in Animated FlashList on Android device onMomentumEnd function not firing in Animated FlashList on Android when using ref.current.scrollToIndex Oct 17, 2024
@matinzd
Copy link

matinzd commented Nov 7, 2024

This is also happening when using FlatList and only on Android.

@matinzd
Copy link

matinzd commented Nov 7, 2024

Probably related to these issues and pull requests:

@DOPAgyeman
Copy link
Author

Probably related to these issues and pull requests:

Thanks - I have looked through those but still doesn't seem like there is a fix

@tomekzaw I can see from previous PR's/issues that you were working on this previously. Do you happen to have a workaround for this issue? Thank you!

@tomekzaw
Copy link
Member

tomekzaw commented Nov 7, 2024

Hi @DOPAgyeman, nope, unfortunately I don't have a workaround for this.

@dhruvbhatia
Copy link

Seems this will be resolved upstream in React Native (see this comment and related PR).

@DOPAgyeman
Copy link
Author

Seems this will be resolved upstream in React Native (see this comment and related PR).

Great - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided
Projects
None yet
Development

No branches or pull requests

4 participants