Skip to content

Commit

Permalink
do not send onScroll event when ScrollView is reused (facebook#43676)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#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
  • Loading branch information
sammy-SC authored and pull[bot] committed Aug 20, 2024
1 parent 5c2cbf8 commit b1f1418
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ - (void)_updateStateWithContentOffset

- (void)prepareForRecycle
{
[super prepareForRecycle];
const auto &props = static_cast<const ScrollViewProps &>(*_props);
_scrollView.contentOffset = RCTCGPointFromPoint(props.contentOffset);
// We set the default behavior to "never" so that iOS
Expand All @@ -433,7 +434,6 @@ - (void)prepareForRecycle
_contentView = nil;
_prevFirstVisibleFrame = CGRectZero;
_firstVisibleView = nil;
[super prepareForRecycle];
}

#pragma mark - UIScrollViewDelegate
Expand Down

0 comments on commit b1f1418

Please sign in to comment.