Skip to content
This repository has been archived by the owner on Feb 18, 2019. It is now read-only.

Commit

Permalink
Correct scrollEventThrottle docs
Browse files Browse the repository at this point in the history
Summary:The docs indicated that a higher number was more accurate, however based on the implementation:

```
  /**
   * TODO: this logic looks wrong, and it may be because it is. Currently, if _scrollEventThrottle
   * is set to zero (the default), the "didScroll" event is only sent once per scroll, instead of repeatedly
   * while scrolling as expected. However, if you "fix" that bug, ScrollView will generate repeated
   * warnings, and behave strangely (ListView works fine however), so don't fix it unless you fix that too!
   */
  if (_allowNextScrollNoMatterWhat ||
      (_scrollEventThrottle > 0 && _scrollEventThrottle < (now - _lastScrollDispatchTime)))
```
https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L564

It appears that only 0 is a special case here, and perhaps a known issue ;)
Closes facebook#3729

Differential Revision: D3074801

Pulled By: mkonicek

fb-gh-sync-id: f63b00755f7565165cc628085efa5ed96badcfe1
shipit-source-id: f63b00755f7565165cc628085efa5ed96badcfe1
  • Loading branch information
nickhudkins authored and Facebook Github Bot 3 committed Mar 20, 2016
1 parent ac2571d commit a3ba25e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,14 @@ var ScrollView = React.createClass({
scrollEnabled: PropTypes.bool,
/**
* This controls how often the scroll event will be fired while scrolling
* (in events per seconds). A higher number yields better accuracy for code
* (as a time interval in ms). A lower number yields better accuracy for code
* that is tracking the scroll position, but can lead to scroll performance
* problems due to the volume of information being send over the bridge.
* The default value is zero, which means the scroll event will be sent
* only once each time the view is scrolled.
* You will not notice a difference between values set between 1-16 as the
* JS run loop is synced to the screen refresh rate. If you do not need precise
* scroll position tracking, set this value higher to limit the information
* being sent across the bridge. The default value is zero, which results in
* the scroll event being sent only once each time the view is scrolled.
* @platform ios
*/
scrollEventThrottle: PropTypes.number,
Expand Down

0 comments on commit a3ba25e

Please sign in to comment.