Skip to content

Commit

Permalink
fix: reordering children could cause errors
Browse files Browse the repository at this point in the history
  • Loading branch information
trezy committed Jul 26, 2024
1 parent b069788 commit 9964a3f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/helpers/insertBefore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ export function insertBefore(
{
const childContainerInstance = childInstance as HostConfig['containerInstance'];
const childContainer = childInstance as unknown as Container;
const beforeChildContainer = beforeChildInstance as unknown as Container;

if (childContainerInstance.parent === parentInstance)
{
parentInstance.removeChild(childContainer);
}

const index = parentInstance.getChildIndex(childContainer);
const index = parentInstance.getChildIndex(beforeChildContainer);

parentInstance.addChildAt(childContainer, index);
}
Expand Down

0 comments on commit 9964a3f

Please sign in to comment.