From 1ee3055f37490b3f6f3e8cbef1a115eb02a12c15 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 27 Jan 2019 08:42:09 -0500 Subject: [PATCH] Calling layout on children before laying out node --- src/layout.js | 4 ++++ src/rendering/SVG/layout.js | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/layout.js b/src/layout.js index ac57841..bc164d9 100644 --- a/src/layout.js +++ b/src/layout.js @@ -16,6 +16,10 @@ const layout = data => { const { type } = data; + if (data.children) { + data.children = data.children.map(layout); + } + return nodeTypes[type]({ props: {}, ...data diff --git a/src/rendering/SVG/layout.js b/src/rendering/SVG/layout.js index 1caf46d..929f69b 100644 --- a/src/rendering/SVG/layout.js +++ b/src/rendering/SVG/layout.js @@ -1,7 +1,5 @@ -import layout from 'layout'; - const layoutSVG = data => { - const child = layout(data.children[0]); + const child = data.children[0]; data.props.innerWidth = child.box.width; data.props.innerHeight = child.box.height;