Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ @implementation RCTScrollViewComponentView {
__weak UIView *_contentView;

CGRect _prevFirstVisibleFrame;
NSInteger _firstVisibleViewTag;
__weak UIView *_firstVisibleView;

CGFloat _endDraggingSensitivityMultiplier;
Expand Down Expand Up @@ -677,6 +678,7 @@ - (void)prepareForRecycle
self.frame = oldFrame;
_contentView = nil;
_prevFirstVisibleFrame = CGRectZero;
_firstVisibleViewTag = 0;
_firstVisibleView = nil;
}

Expand Down Expand Up @@ -1036,6 +1038,7 @@ - (void)_prepareForMaintainVisibleScrollPosition
}
if (hasNewView || ii == _contentView.subviews.count - 1) {
_prevFirstVisibleFrame = subview.frame;
_firstVisibleViewTag = subview.tag;
_firstVisibleView = subview;
break;
}
Expand All @@ -1049,6 +1052,12 @@ - (void)_adjustForMaintainVisibleContentPosition
return;
}

if(_firstVisibleView && _firstVisibleView.tag != _firstVisibleViewTag) {
_prevFirstVisibleFrame = CGRectZero;
_firstVisibleViewTag = 0;
_firstVisibleView = nil;
}

std::optional<int> autoscrollThreshold = props.maintainVisibleContentPosition.value().autoscrollToTopThreshold;
BOOL horizontal = _scrollView.contentSize.width > self.frame.size.width;
// TODO: detect and handle/ignore re-ordering
Expand Down
Loading