mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Notify ViewManagers when a View is deleted
Summary: In a previous recent diff we changed Android's Delete mount instruction to *not* recursively delete the tree. This is fine, but because of that, we stopped calling `onDropViewInstance` when views are normally deleted. Bring back that behaviour. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D23801666 fbshipit-source-id: 54e6b52ab51fff2a45102e37077fe41081499888
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7c93f5b001
commit
7b82df287d
@@ -399,7 +399,7 @@ public class MountingManager {
|
||||
}
|
||||
|
||||
throw new IllegalStateException(
|
||||
"Tried to delete view ["
|
||||
"Tried to remove view ["
|
||||
+ tag
|
||||
+ "] of parent ["
|
||||
+ parentTag
|
||||
@@ -586,6 +586,12 @@ public class MountingManager {
|
||||
// Additionally, as documented in `dropView`, we cannot always trust a
|
||||
// view's children to be up-to-date.
|
||||
mTagToViewState.remove(reactTag);
|
||||
|
||||
// For non-root views we notify viewmanager with {@link ViewManager#onDropInstance}
|
||||
ViewManager viewManager = viewState.mViewManager;
|
||||
if (!viewState.mIsRoot && viewManager != null) {
|
||||
viewManager.onDropViewInstance(viewState.mView);
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
|
||||
Reference in New Issue
Block a user