File tree 3 files changed +18
-8
lines changed
3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,6 @@ const ScrollView = require('ScrollView');
14
14
15
15
const createAnimatedComponent = require ( 'createAnimatedComponent' ) ;
16
16
17
- module . exports = createAnimatedComponent ( ScrollView , { scrollEventThrottle : 16 } ) ;
17
+ module . exports = createAnimatedComponent ( ScrollView , {
18
+ scrollEventThrottle : 0.0001 ,
19
+ } ) ;
Original file line number Diff line number Diff line change @@ -206,11 +206,16 @@ type IOSProps = $ReadOnly<{|
206
206
* (as a time interval in ms). A lower number yields better accuracy for code
207
207
* that is tracking the scroll position, but can lead to scroll performance
208
208
* problems due to the volume of information being send over the bridge.
209
- * You will not notice a difference between values set between 1-16 as the
210
- * JS run loop is synced to the screen refresh rate. If you do not need precise
211
- * scroll position tracking, set this value higher to limit the information
212
- * being sent across the bridge. The default value is zero, which results in
213
- * the scroll event being sent only once each time the view is scrolled.
209
+ *
210
+ * Values between 0 and 17ms indicate 60fps updates are needed and throttling
211
+ * will be disabled.
212
+ *
213
+ * If you do not need precise scroll position tracking, set this value higher
214
+ * to limit the information being sent across the bridge.
215
+ *
216
+ * The default value is zero, which results in the scroll event being sent only
217
+ * once each time the view is scrolled.
218
+ *
214
219
* @platform ios
215
220
*/
216
221
scrollEventThrottle ?: ?number ,
Original file line number Diff line number Diff line change @@ -697,16 +697,19 @@ - (void)removeScrollListener:(NSObject<UIScrollViewDelegate> *)scrollListener
697
697
698
698
- (void )scrollViewDidScroll : (UIScrollView *)scrollView
699
699
{
700
- [self updateClippedSubviews ];
701
700
NSTimeInterval now = CACurrentMediaTime ();
701
+ [self updateClippedSubviews ];
702
702
/* *
703
703
* TODO: this logic looks wrong, and it may be because it is. Currently, if _scrollEventThrottle
704
704
* is set to zero (the default), the "didScroll" event is only sent once per scroll, instead of repeatedly
705
705
* while scrolling as expected. However, if you "fix" that bug, ScrollView will generate repeated
706
706
* warnings, and behave strangely (ListView works fine however), so don't fix it unless you fix that too!
707
+ *
708
+ * We limit the delta to 17ms so that small throttles intended to enable 60fps updates will not
709
+ * inadvertantly filter out any scroll events.
707
710
*/
708
711
if (_allowNextScrollNoMatterWhat ||
709
- (_scrollEventThrottle > 0 && _scrollEventThrottle < ( now - _lastScrollDispatchTime))) {
712
+ (_scrollEventThrottle > 0 && _scrollEventThrottle < MAX ( 17 , now - _lastScrollDispatchTime))) {
710
713
711
714
if (_DEPRECATED_sendUpdatedChildFrames) {
712
715
// Calculate changed frames
You can’t perform that action at this time.
0 commit comments