question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scrollTo function does not trigger onMomentumScrollBegin and onMomentumScrollEnd

See original GitHub issue

Having a vectical ScrollView and testing it on Android. If I called scrollview.scrollTo(x:0, y: y`, animated:true) by pressing a button, onMomentumScrollBegin is not called at the start and onMomentumScrollEnd is not called at the end of the automated scrolling.

Environment

Environment: OS: Windows 10 Node: 8.11.0 Yarn: 1.5.1 npm: 5.8.0 Watchman: Not Found Xcode: N/A Android Studio: Not Found

Packages: (wanted => installed) react: ^16.3.1 => 16.3.1 react-native: ^0.55.4 => 0.55.4

Steps to Reproduce

Don’t forget to look at the Log console to see the result.

https://snack.expo.io/@gagnondorf/scrollto-does-not-trigger-onmomentumscrollbegin-end

<div data-snack-id="@gagnondorf/scrollto-does-not-trigger-onmomentumscrollbegin-end" data-snack-platform="android" data-snack-preview="true" data-snack-theme="dark" style="overflow:hidden;background:#212733;border:1px solid rgba(0,0,0,.08);border-radius:4px;height:505px;width:100%"></div> <script async src="https://snack.expo.io/embed.js"></script>

Expected Behavior

When scrollTo is called, OnMomentumScrollBegin should be called at the begining and OnMomentumScrollEnd should be called when the auto-scrolling is over.

Description of thoses methods in React-Native docs: onScroll Fires at most once per frame during scrolling. The frequency of the events can be controlled using the scrollEventThrottle prop.

onMomentumScrollBegin Called when the momentum scroll starts (scroll which occurs as the ScrollView glides to a stop).

onMomentumScrollEnd Called when the momentum scroll ends (scroll which occurs as the ScrollView glides to a stop).

Actual Behavior

If the user do not drag with his finger before ScrollTo is called, then onMomentumScrollBegin and onMomentumScrollEnd are not called during the automated scrolling. If the user is dragging, sometimes those functions are triggers.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:5

github_iconTop GitHub Comments

2reactions
hkwincommented, Aug 13, 2018

I have the same issue for android of RN@0.55.4.

0reactions
stale[bot]commented, Nov 18, 2018

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to detect an end of a drag event in React-Native Android
I have put a console.log for onScrollEndDrag and it doesnot give any console output, i.e. onScrollEndDrag is not being detected.
Read more >
ScrollView - React Native
Component that wraps platform ScrollView while providing integration with touch locking "responder" system.
Read more >
ScrollRef - You.i TV Developer Portal
ScrollRef · The props in this topic are a subset of the props that the Facebook React Native ScrollView component supports. · These...
Read more >
React Native ScrollView Component - GeeksforGeeks
onMomentumScrollBegin : It is a callback function that is called when the momentum scroll starts. onMomentumScrollEnd: It is a callback ...
Read more >
onmomentumscrollbegin, sectionlist onendreached ...
Type Required; function: No: onMomentumScrollEnd. When scrollTo is called, OnMomentumScrollBegin should be called at the begining and OnMomentumScrollEnd ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found