From 9964a3f02dd9126a91180f15129a3eab7ac97866 Mon Sep 17 00:00:00 2001 From: Trezy Date: Fri, 26 Jul 2024 14:55:11 -0500 Subject: [PATCH] fix: reordering children could cause errors --- src/helpers/insertBefore.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helpers/insertBefore.ts b/src/helpers/insertBefore.ts index 4c8fe115..24cd518c 100644 --- a/src/helpers/insertBefore.ts +++ b/src/helpers/insertBefore.ts @@ -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); }