Skip to content

Commit

Permalink
do not send onScroll event when ScrollView is reused (#43676)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Mar 27, 2024
1 parent 59a43e6 commit 575507d
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 575507d

Please sign in to comment.