From 67af6e54fcafed38c677206f81687b665ad2e3d7 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 8 Sep 2020 10:50:25 -0700 Subject: [PATCH] Fix removal for nested legacy interop layer Summary: Changelog: [Internal] In https://fburl.com/diffusion/3705cj0i we assert that view which is about to be recycled, has no superview. This is a problem in Legacy interop layer which is nested within another interop layer. This originally wasn't considered. Removing views in `finalizeUpdates` like it has been done until now is not enough because when a component is deleted, `finaliseUpdates` isn't called. Reviewed By: shergin Differential Revision: D23572999 fbshipit-source-id: f007dfe293b7d27d56253656c02529163304f83c --- .../RCTLegacyViewManagerInteropComponentView.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index 2bb5ef0168e..8c9a97ce6aa 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -99,7 +99,11 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index"; - (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index { - [_viewsToBeUnmounted addObject:childComponentView]; + if (_adapter) { + [_adapter.paperView removeReactSubview:childComponentView]; + } else { + [_viewsToBeUnmounted addObject:childComponentView]; + } } + (ComponentDescriptorProvider)componentDescriptorProvider