From b2f76058550a542ef500b71b41f81f410fc9d1e4 Mon Sep 17 00:00:00 2001 From: Mikael Sand Date: Thu, 5 Mar 2020 13:02:35 +0200 Subject: [PATCH] fix: #1262 support single dimension + aspectRatio syntax --- src/elements/Svg.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/elements/Svg.tsx b/src/elements/Svg.tsx index 437304f5..5a718b12 100644 --- a/src/elements/Svg.tsx +++ b/src/elements/Svg.tsx @@ -116,10 +116,10 @@ export default class Svg extends Shape< ...(Array.isArray(style) ? Object.assign({}, ...style) : style), ...extracted, }; - const { + let { color, - width = '100%', - height = '100%', + width, + height, focusable, // Inherited G properties @@ -137,6 +137,9 @@ export default class Svg extends Shape< strokeLinejoin, strokeMiterlimit, } = stylesAndProps; + if (width === undefined && height === undefined) { + width = height = '100%'; + } const props: extractedProps = extracted as extractedProps; props.focusable = Boolean(focusable) && focusable !== 'false';