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
This commit is contained in:
Samuel Susla
2020-09-08 10:53:57 -07:00
committed by Facebook GitHub Bot
parent 4b95bb2f84
commit 67af6e54fc
@@ -99,7 +99,11 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
[_viewsToBeUnmounted addObject:childComponentView];
if (_adapter) {
[_adapter.paperView removeReactSubview:childComponentView];
} else {
[_viewsToBeUnmounted addObject:childComponentView];
}
}
+ (ComponentDescriptorProvider)componentDescriptorProvider