mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-19 21:29:36 +08:00
Correct scrollEventThrottle docs
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 https://github.com/facebook/react-native/pull/3729
Differential Revision: D3074801
Pulled By: mkonicek
fb-gh-sync-id: f63b00755f7565165cc628085efa5ed96badcfe1
shipit-source-id: f63b00755f7565165cc628085efa5ed96badcfe1
This commit is contained in:
committed by
Facebook Github Bot 3
parent
ac2571d5ec
commit
a3ba25ed90
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user