From 10b3e0e8688a7a140578fe25e799d4b379595e69 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Wed, 29 Nov 2023 11:31:24 -0800 Subject: [PATCH] Converge iOS oldarch scrollEventThrottle behavior (#41695) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41695 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 fbshipit-source-id: e2a57f3501b9096e4033cb198bbc214d53e9913c --- 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;