disable subview clipping traversal when view culling is enabled (#52903)

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

changelog: [internal]

disable subview clipping traversal when view culling is enabled.
Subview clipping is already disabled by preventing prop from being set to true: https://fburl.com/code/bynvtwfs but we found a crash where the traversal leads to memory corruption with view culling enabled.

Reviewed By: lenaic

Differential Revision: D79168116

fbshipit-source-id: 9dcb624ca12bc2d94b265681795604ee0ac3fe00
This commit is contained in:
Samuel Susla
2025-07-29 09:43:44 -07:00
committed by Facebook GitHub Bot
parent 4b07edd6ea
commit 7afb8ab305
@@ -947,6 +947,10 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
- (void)_remountChildrenIfNeeded
{
if (ReactNativeFeatureFlags::enableViewCulling()) {
return;
}
CGPoint contentOffset = _scrollView.contentOffset;
if (std::abs(_contentOffsetWhenClipped.x - contentOffset.x) < kClippingLeeway &&
@@ -961,6 +965,10 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
- (void)_remountChildren
{
if (ReactNativeFeatureFlags::enableViewCulling()) {
return;
}
[_scrollView updateClippedSubviewsWithClipRect:CGRectInset(_scrollView.bounds, -kClippingLeeway, -kClippingLeeway)
relativeToView:_scrollView];
}