mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix flattening/unflattening case on Android
Summary: There are cases where we Delete+Create a node in the same frame. Practically, the new differ should prevent this, but we don't want to rely on that necessarily. See comments for further justification on why deleteView can do less work overall. In reparenting cases, this causes crashes because dropView removes *and deletes* children that shouldn't necessarily be deleted. Changelog: [Internal] Reviewed By: shergin Differential Revision: D23775453 fbshipit-source-id: c577c5af8c27cfb185d527f0afd8aeb08ee3a5fe
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d8b70b19b3
commit
fa44c46e37
@@ -577,13 +577,15 @@ public class MountingManager {
|
||||
return;
|
||||
}
|
||||
|
||||
View view = viewState.mView;
|
||||
|
||||
if (view != null) {
|
||||
dropView(view, false);
|
||||
} else {
|
||||
mTagToViewState.remove(reactTag);
|
||||
}
|
||||
// To delete we simply remove the tag from the registry.
|
||||
// In the past we called dropView here, but we want to rely on either
|
||||
// (1) the correct set of MountInstructions being sent to the platform
|
||||
// and/or (2) dropView being called by stopSurface.
|
||||
// If Views are orphaned at this stage and leaked, it's a problem in
|
||||
// the differ or LayoutAnimations, not MountingManager.
|
||||
// Additionally, as documented in `dropView`, we cannot always trust a
|
||||
// view's children to be up-to-date.
|
||||
mTagToViewState.remove(reactTag);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
|
||||
Reference in New Issue
Block a user