Skip to content

Commit

Permalink
Fix Box navigation after removing chind View
Browse files Browse the repository at this point in the history
  • Loading branch information
XITRIX committed Oct 29, 2024
1 parent bcbd435 commit d189a7a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/lib/core/box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ void Box::removeView(View* view, bool free)
YGNodeRemoveChild(this->ygNode, view->getYGNode());
this->children.erase(this->children.begin() + index);

// Update parent userdata
for (size_t i = index; i < this->children.size(); i++)
{
auto* index = (size_t*)this->children[i]->getParentUserData();
if (index)
(*index)--;
}

view->willDisappear(true);
if (free)
view->freeView();
Expand Down

0 comments on commit d189a7a

Please sign in to comment.