mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
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
This commit is contained in:
parent
55a4d105e7
commit
38fb83ca86
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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')}
|
||||
|
Loading…
Reference in New Issue
Block a user