Skip to content

Commit

Permalink
Revert D65556000
Browse files Browse the repository at this point in the history
Summary:
Reverts facebook#47468

Changelog: [Internal]

Differential Revision: D66030953
  • Loading branch information
Dark Knight authored and facebook-github-bot committed Nov 15, 2024
1 parent 7a5a10c commit 9a237d0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,6 @@ - (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
// 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]);
}
}

Expand Down
6 changes: 0 additions & 6 deletions packages/react-native/React/Views/ScrollView/RCTScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,6 @@ - (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
offset = CGPointMake(x, y);
}
[_scrollView setContentOffset:offset animated:animated];
if (animated) {
[self sendScrollEventWithName:@"onMomentumScrollBegin" scrollView:_scrollView userData:nil];
}
}
}

Expand All @@ -625,9 +622,6 @@ - (void)scrollToEnd:(BOOL)animated
// Ensure at least one scroll event will fire
_allowNextScrollNoMatterWhat = YES;
[_scrollView setContentOffset:offset animated:animated];
if (animated) {
[self sendScrollEventWithName:@"onMomentumScrollBegin" scrollView:_scrollView userData:nil];
}
}
}

Expand Down
12 changes: 1 addition & 11 deletions packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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')}
Expand Down

0 comments on commit 9a237d0

Please sign in to comment.