Revert D65556000 (#47642)
Some checks are pending
Label closed PR as merged and leave a comment / comment-and-label (push) Waiting to run
Publish Bumped Packages / publish_bumped_packages (push) Waiting to run
Update node modules cache / update_node_modules_cache (push) Waiting to run

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
This commit is contained in:
generatedunixname89002005232357 2024-11-15 16:55:33 -08:00 committed by Facebook GitHub Bot
parent 55a4d105e7
commit 38fb83ca86
3 changed files with 1 additions and 19 deletions

View File

@ -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<const ScrollViewEventEmitter &>(*_eventEmitter).onMomentumScrollBegin([self _scrollViewMetrics]);
}
}

View File

@ -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];
}
}
}

View File

@ -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<?React.ElementRef<typeof ScrollView>>(null);
const [scroll, setScroll] = useState('none');
return (
<View>
<RNTesterText>Scroll State: {scroll}</RNTesterText>
<Button
label="scrollTo top (animated)"
onPress={() => ref.current?.scrollTo({x: 0, y: 0, animated: true})}
/>
<Button
label="scrollTo top (not animated)"
onPress={() => ref.current?.scrollTo({x: 0, y: 0, animated: false})}
/>
<ScrollView
ref={ref}
style={[styles.scrollView, {height: 200}]}
onMomentumScrollBegin={() => setScroll('onMomentumScrollBegin')}
onMomentumScrollEnd={() => setScroll('onMomentumScrollEnd')}