Skip to content

Commit

Permalink
fix(android): sticky header not deleted from ControllerManager
Browse files Browse the repository at this point in the history
may crash in vue2 when recreating view with same id
  • Loading branch information
iPel committed Jul 5, 2023
1 parent a156a22 commit 7a8173e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ private boolean checkRecyclable(@Nullable HippyViewController controller, boolea

@SuppressWarnings({"unchecked", "rawtypes"})
public void deleteChildRecursive(int rootId, ViewGroup parent, View child, boolean recyclable) {
if (parent == null || child == null) {
if (child == null) {
return;
}
HippyViewController childController = null;
Expand Down Expand Up @@ -555,15 +555,17 @@ public void deleteChildRecursive(int rootId, ViewGroup parent, View child, boole
}
}
}
String parentTag = NativeViewTag.getClassName(parent);
if (parentTag != null) {
HippyViewController parentController = mControllerRegistry.getViewController(
parentTag);
if (parentController != null) {
parentController.deleteChild(parent, child);
if (parent != null) {
String parentTag = NativeViewTag.getClassName(parent);
if (parentTag != null) {
HippyViewController parentController = mControllerRegistry.getViewController(
parentTag);
if (parentController != null) {
parentController.deleteChild(parent, child);
}
} else {
parent.removeView(child);
}
} else {
parent.removeView(child);
}
mControllerRegistry.removeView(rootId, child.getId());
if (checkRecyclable(childController, recyclable) && childTag != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void removeView() {
if (parentNode != null) {
mControllerManager.deleteChild(mRootId, parentNode.getId(), mId, true);
} else {
removeChildrenView(this);
mControllerManager.deleteChildRecursive(mRootId, null, getHostView(), true);
}
}

Expand Down

0 comments on commit 7a8173e

Please sign in to comment.