SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Reset contentInset in scroll view prepareForRecycle (#55733)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55733

React Native's Fabric view recycling pools UIScrollView instances by component type, meaning vertical and horizontal scroll views share the same pool. When a scroll view is recycled via prepareForRecycle, contentInset is not reset. This causes stale bottom insets set at runtime (e.g., by the floating tab bar's content inset adjustment) to leak into recycled scroll views.

This manifests as horizontal FlatLists allowing vertical/diagonal scrolling because they inherit a non-zero bottom contentInset from a previously vertical scroll view.

Fix: Reset contentInset to UIEdgeInsetsZero in prepareForRecycle, consistent with how contentOffset, zoomScale, and contentInsetAdjustmentBehavior are already reset.

Changelog: Internal

More Context: https://fb.workplace.com/groups/rn.support/posts/30810820418539846/?comment_id=30811286738493214&reply_comment_id=30821628410792380

Reviewed By: cipolleschi

Differential Revision: D93342311

fbshipit-source-id: 84c4597596e36a535f9a10840b1ddf280f6402df
S
Sandeep Kumar committed
984dbe83d8de76fd94c191173dc23897d31edcd8
Parent: 4d66a26
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 2/25/2026, 9:05:13 PM