mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Unmount view from the reactsubviews in the Interop Layer (#43111)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43111 When mounting views in the interop layer, we register them in an array `reactSubview` that is added to `UIView`. However, when unmounting them, we were just removing them from the parent view. This worked fine while the view we were adding to reactSubview was the same that we were adding to hierarchy. However, there are instances where libraries might wrap those views in some custom wrappers. This break the assumption that the same view we are adding to the UI hierarchy is the same view we will remove. With this change, we make sure to use the same semantic when we add some view and when we remove it. This also fixes a crash that happens with Mobile home when navigating away from the Ride's Map, using Fabric. ## Changelog [internal] - Remove views from hierarchy using the view that is added to the `reactSubviews` Reviewed By: sammy-SC Differential Revision: D53943728 fbshipit-source-id: 56e669c14db74b6af683384b6ca72ad3f5cfdafe
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1fc2a5a4c9
commit
488dd78d7c
+2
-2
@@ -179,8 +179,8 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
|
||||
|
||||
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
||||
{
|
||||
if (_adapter) {
|
||||
[_adapter.paperView removeReactSubview:childComponentView];
|
||||
if (_adapter && index < _adapter.paperView.reactSubviews.count) {
|
||||
[_adapter.paperView removeReactSubview:_adapter.paperView.reactSubviews[index]];
|
||||
} else {
|
||||
[_viewsToBeUnmounted addObject:childComponentView];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user