From 38fb83ca86d6f7bd19e4b534b3d746dea6830aef Mon Sep 17 00:00:00 2001 From: generatedunixname89002005232357 Date: Fri, 15 Nov 2024 16:55:33 -0800 Subject: [PATCH] Revert D65556000 (#47642) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47642 Reverts https://github.com/facebook/react-native/pull/47468 Changelog: [Internal] Reviewed By: Abbondanzo Differential Revision: D66030953 fbshipit-source-id: aea1f681e1916cc234b69bce650670451829bb55 --- .../ScrollView/RCTScrollViewComponentView.mm | 2 -- .../React/Views/ScrollView/RCTScrollView.m | 6 ------ .../js/examples/ScrollView/ScrollViewExample.js | 12 +----------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 48cdc2de8da..95f38d95fac 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -903,8 +903,6 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu // When not animated, the expected workflow in ``scrollViewDidEndScrollingAnimation`` after scrolling is not going // to get triggered. We will need to manually execute here. [self _handleFinishedScrolling:_scrollView]; - } else if (_eventEmitter) { - static_cast(*_eventEmitter).onMomentumScrollBegin([self _scrollViewMetrics]); } } diff --git a/packages/react-native/React/Views/ScrollView/RCTScrollView.m b/packages/react-native/React/Views/ScrollView/RCTScrollView.m index 3fc9a47f3ed..e83b91de675 100644 --- a/packages/react-native/React/Views/ScrollView/RCTScrollView.m +++ b/packages/react-native/React/Views/ScrollView/RCTScrollView.m @@ -600,9 +600,6 @@ static inline void RCTApplyTransformationAccordingLayoutDirection( offset = CGPointMake(x, y); } [_scrollView setContentOffset:offset animated:animated]; - if (animated) { - [self sendScrollEventWithName:@"onMomentumScrollBegin" scrollView:_scrollView userData:nil]; - } } } @@ -625,9 +622,6 @@ static inline void RCTApplyTransformationAccordingLayoutDirection( // Ensure at least one scroll event will fire _allowNextScrollNoMatterWhat = YES; [_scrollView setContentOffset:offset animated:animated]; - if (animated) { - [self sendScrollEventWithName:@"onMomentumScrollBegin" scrollView:_scrollView userData:nil]; - } } } diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js index 074cd7130e3..ae0b34365c5 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js @@ -15,7 +15,7 @@ import RNTesterText from '../../components/RNTesterText'; import ScrollViewPressableStickyHeaderExample from './ScrollViewPressableStickyHeaderExample'; import nullthrows from 'nullthrows'; import * as React from 'react'; -import {useCallback, useRef, useState} from 'react'; +import {useCallback, useState} from 'react'; import { Platform, RefreshControl, @@ -855,21 +855,11 @@ const OnScrollOptions = () => { }; const OnMomentumScroll = () => { - const ref = useRef>(null); const [scroll, setScroll] = useState('none'); return ( Scroll State: {scroll} -