From 99c9337d2e15204575549952d863a168a9008251 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Wed, 29 Nov 2023 10:36:27 -0800 Subject: [PATCH] Converge iOS oldarch scrollEventThrottle behavior (#41695) Summary: When I went to update documentation, I kinda internalized how inconsistent the API is if we don't change iOS Paper. The potential for breaks is if an iOS-specific component ignores a warning, and uses `onScroll` without `scrollEventThrottle`, then relies on `onScroll` only being called once. It didn't seem like we hit this scenario in practice when migrating Fabric ComponentView behavior, and components will need to support it in new arch anyway, so this change takes the less conservative option of unifying the behavior everywhere. Changelog: [iOS][Changed] - scrollEventThrottle no longer needs to be set for continuous scroll events Reviewed By: cipolleschi Differential Revision: D51647202 --- packages/react-native/React/Views/ScrollView/RCTScrollView.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/react-native/React/Views/ScrollView/RCTScrollView.m b/packages/react-native/React/Views/ScrollView/RCTScrollView.m index 98b7f14533b081..3ad69069ef15d9 100644 --- a/packages/react-native/React/Views/ScrollView/RCTScrollView.m +++ b/packages/react-native/React/Views/ScrollView/RCTScrollView.m @@ -674,8 +674,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView * We limit the delta to 17ms so that small throttles intended to enable 60fps updates will not * inadvertently filter out any scroll events. */ - if (_allowNextScrollNoMatterWhat || - (_scrollEventThrottle > 0 && _scrollEventThrottle < MAX(0.017, now - _lastScrollDispatchTime))) { + if (_allowNextScrollNoMatterWhat || (_scrollEventThrottle < MAX(0.017, now - _lastScrollDispatchTime))) { RCT_SEND_SCROLL_EVENT(onScroll, nil); // Update dispatch time _lastScrollDispatchTime = now;