mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-05 17:30:38 +08:00
Don't try to remove Views that about to be removed with the root View
Summary: We keep a list of FlatShadowNodes that mount to Views that we want to delete, and only flush it at the end of an update cycle. This results in a situation where a root view is being removed before children are removed, which results in a crash in NativeViewHierarchyManager because a View that we are trying to remove no longer exists. There are a few approaches to fix the issue: a) make a check if a View exists before removing it. While works, it removes a bug protection when we erroneously trying to remove a View that no longer exists (such as this). I'd prefer to keep the check in place b) flush the views-to-drop queue. This works, but does some extra work in UI thread (namely, removing Views that would be removed anyway) c) trim the views-to-drop queue to remove any Views that will be removed anyway. This does a tiny bit of extra work in BG thread, but less work in UI thread. This diff implements option c). Reviewed By: ahmedre Differential Revision: D2990105
This commit is contained in:
committed by
Ahmed El-Helw
parent
75117fc91a
commit
0b560d3d3d
@@ -389,6 +389,12 @@ public class FlatUIImplementation extends UIImplementation {
|
||||
mStateBuilder.applyUpdates(eventDispatcher, (FlatRootShadowNode) cssNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRootView(int rootViewTag) {
|
||||
mStateBuilder.removeRootView(rootViewTag);
|
||||
super.removeRootView(rootViewTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJSResponder(int possiblyVirtualReactTag, boolean blockNativeResponder) {
|
||||
ReactShadowNode node = resolveShadowNode(possiblyVirtualReactTag);
|
||||
|
||||
Reference in New Issue
Block a user