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;