mirror of
https://github.com/status-im/react-native.git
synced 2025-02-22 06:08:24 +00:00
Fix crash when removing root nodes
Summary: If a children of a root node is being removed and the Root Node is empty, it was likely already removed and cleaned previously, likely due to a race condition caused by RN's async nature. In those cases, let's avoid crashing the app and instead silently ignore the root view removal. Reviewed By: fkgozali Differential Revision: D13405817 fbshipit-source-id: 0179d10a88a2d19f1db5ea35b48cb83d9d7429a6
This commit is contained in:
parent
2918679479
commit
39b6890346
@ -382,6 +382,11 @@ public class NativeViewHierarchyManager {
|
||||
tagsToDelete));
|
||||
}
|
||||
if (indexToRemove >= viewManager.getChildCount(viewToManage)) {
|
||||
if (mRootTags.get(tag) && viewManager.getChildCount(viewToManage) == 0) {
|
||||
// This root node has already been removed (likely due to a threading issue caused by
|
||||
// async js execution). Ignore this root removal.
|
||||
return;
|
||||
}
|
||||
throw new IllegalViewOperationException(
|
||||
"Trying to remove a view index above child " +
|
||||
"count " + indexToRemove + " view tag: " + tag + "\n detail: " +
|
||||
|
Loading…
x
Reference in New Issue
Block a user