fix node collapse edge case

This commit is contained in:
Evan Simkowitz 2024-08-27 13:25:02 -07:00
parent ab5a9ec749
commit 8fcc856740
No known key found for this signature in database

View File

@ -186,7 +186,6 @@ export function balanceNode(
walkNodes(
node,
(node) => {
beforeWalkCallback?.(node);
if (!validateNode(node)) throw new Error("Invalid node");
node.children = node.children?.flatMap((child) => {
if (child.flexDirection === node.flexDirection) {
@ -198,6 +197,7 @@ export function balanceNode(
if (child.children?.length === 0) return;
return child;
});
beforeWalkCallback?.(node);
},
(node) => {
node.children = node.children?.filter((v) => v);