Skip to content

Commit b1f1418

Browse files
sammy-SCpull[bot]
authored andcommitted
do not send onScroll event when ScrollView is reused (#43676)
Summary: Pull Request resolved: #43676 changelog: [internal] calling super invalidates eventEmitter. EventEmitter should be invalidated before reseting contentOffset on `_scrollView. Otherwise, UIScrollView::setContentOffset is called and it calls delegate method: `scrollViewDidScroll`. Reviewed By: javache Differential Revision: D55375060 fbshipit-source-id: f697805eb1ca05d15cf498ff9e5e06e90eb7ac56
1 parent 5c2cbf8 commit b1f1418

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ - (void)_updateStateWithContentOffset
418418

419419
- (void)prepareForRecycle
420420
{
421+
[super prepareForRecycle];
421422
const auto &props = static_cast<const ScrollViewProps &>(*_props);
422423
_scrollView.contentOffset = RCTCGPointFromPoint(props.contentOffset);
423424
// We set the default behavior to "never" so that iOS
@@ -433,7 +434,6 @@ - (void)prepareForRecycle
433434
_contentView = nil;
434435
_prevFirstVisibleFrame = CGRectZero;
435436
_firstVisibleView = nil;
436-
[super prepareForRecycle];
437437
}
438438

439439
#pragma mark - UIScrollViewDelegate

0 commit comments

Comments
 (0)