You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[0.88 regression] iOS: maintainVisibleContentPosition skips the correction when removeClippedSubviews has detached the anchor #58910
Since #57294 (0.88.0-rc.0), a ScrollView or FlatList with both maintainVisibleContentPosition and removeClippedSubviews no longer corrects for a prepend taller than about a screen. The visible content is pushed down by the prepend's full height. 0.87.1 holds it.
In the repro, a ScrollView at y=2000 gets 12 rows of 200pt prepended:
removeClippedSubviews on
off
0.87.1
held (2/2)
held
0.88.0-rc.4, unmodified
pushed down 2400pt (3/3)
held
0.87.1 with main's guard
pushed down 2400pt (2/2)
held
0.87.1 with main's guard minus the check below
held (2/2)
Cause
#57294 added this check to _adjustForMaintainVisibleContentPosition (L1114-L1118):
if (_firstVisibleView.superview != _contentView) {
return;
}
-mountingTransactionDidMount runs -_remountChildren before the adjustment. With removeClippedSubviews, a prepend moves the anchor out of the clip rect, so -_remountChildren detaches it, and the check returns. But the detached anchor is still a valid anchor: the content view still holds it in _reactSubviews, and it already has the new frame. That frame is what 0.87.1 corrects with.
The check isn't needed to catch deleted views. The registry resets a view's tag to 0 when it's enqueued (RCTComponentViewRegistry.mm#L67-L68), so the tag check just above already returns for those.
Fix
Remove the check. PR to follow.
Steps to reproduce
git clone https://github.com/mozzius/scrollview-mvcp-anchor-repro && cd scrollview-mvcp-anchor-repro/ReproducerApp && yarn install
cd ios && bundle install && RCT_USE_PREBUILT_RNCORE=0 bundle exec pod install && cd .. (core must be built from source for the repro's patch to compile in)
yarn start, then yarn ios
Open B: unmounted, turn Clip on, set Guard to main, and tap Prepend. It reports +2400.0pt: JUMPED.
Set Guard to 0.87.1 or fix and tap Prepend. It reports +0.0pt: held.
The repro's App.tsx in an unmodified 0.88.0-rc.4 app shows the same jump at step 4.
Activity