mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 22:23:37 +00:00
Don't crash on dropping a dropped view in Nodes
Summary: In Nodes, we sometimes get crashes when we drop an already dropped view. For now, this catches the exception to allow things to be handled gracefully (until we can identify the actual root cause). #accept2ship Reviewed By: sriramramani Differential Revision: D4059333
This commit is contained in:
parent
c10bbe5599
commit
7af3331171
@ -191,8 +191,12 @@ import com.facebook.react.uimanager.ViewManagerRegistry;
|
||||
int viewToDrop = viewsToDrop.keyAt(i);
|
||||
View view = null;
|
||||
if (viewToDrop > 0) {
|
||||
view = resolveView(viewToDrop);
|
||||
dropView(view);
|
||||
try {
|
||||
view = resolveView(viewToDrop);
|
||||
dropView(view);
|
||||
} catch (Exception e) {
|
||||
// the view is already dropped, nothing we can do
|
||||
}
|
||||
} else {
|
||||
// Root views are noted with a negative tag from StateBuilder.
|
||||
removeRootView(-viewToDrop);
|
||||
@ -229,7 +233,13 @@ import com.facebook.react.uimanager.ViewManagerRegistry;
|
||||
SparseArray<View> detachedViews = flatViewGroup.getDetachedViews();
|
||||
for (int i = 0, size = detachedViews.size(); i < size; i++) {
|
||||
View detachedChild = detachedViews.valueAt(i);
|
||||
dropView(detachedChild);
|
||||
try {
|
||||
dropView(detachedChild);
|
||||
} catch (Exception e) {
|
||||
// if the view is already dropped, ignore any exceptions
|
||||
// in reality, we should find out the edge cases that cause
|
||||
// this to happen and properly fix them.
|
||||
}
|
||||
// trigger onDetachedFromWindow and clean up this detached/clipped view
|
||||
flatViewGroup.removeDetachedView(detachedChild);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user