Skip to content
Closed
Show file tree
Hide file tree
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 @@ -359,7 +359,9 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &

// Disable `removeClippedSubviews` when Fabric View Culling is enabled.
if (!ReactNativeFeatureFlags::enableViewCulling()) {
if (oldViewProps.removeClippedSubviews != newViewProps.removeClippedSubviews) {
// Compare against the current state, not `_props`: `prepareForRecycle` resets
// `_removeClippedSubviews` but keeps `_props`.
if (_removeClippedSubviews != newViewProps.removeClippedSubviews) {
_removeClippedSubviews = newViewProps.removeClippedSubviews;
[self _updateRemoveClippedSubviewsState];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,26 @@ - (void)testUnmountAfterToggleOffCleansUpReactSubviews
XCTAssertNil(child2.superview);
}

- (void)testRemoveClippedSubviewsIsKeptOnRecycledView
{
RCTViewComponentView *view = [RCTViewComponentView new];
[view updateProps:makeViewProps(true) oldProps:ViewShadowNode::defaultSharedProps()];
[view prepareForRecycle];

// Reused for another view with removeClippedSubviews. Like the mounting layer
// does for an Insert, pass no old props: the view diffs against its own.
[view updateProps:makeViewProps(true) oldProps:nullptr];

UIView *child = [UIView new];
child.frame = CGRectMake(0, 400, 50, 50);
[view mountChildComponentView:(id)child index:0];

// Clipping is on, so the child is tracked and left for the clipping pass to attach.
XCTAssertNil(child.superview);
NSMutableArray *reactSubviews = [view valueForKey:@"_reactSubviews"];
XCTAssertEqual(reactSubviews.count, 1u);
}

#pragma mark - hitTest against non-invertible transforms (#50797)

- (void)testHitTestReturnsNilForZeroScaleYView
Expand Down
Loading