From 03322a756f44863543673ff597582444c180989b Mon Sep 17 00:00:00 2001 From: Diego Muracciole Date: Sat, 16 Nov 2024 23:58:37 +0100 Subject: [PATCH] fix: stroke dash array computation (#2948) * fix: stroke dash array computation * Create beige-tools-appear.md --- .changeset/beige-tools-appear.md | 5 +++++ packages/render/src/primitives/renderSvg.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/beige-tools-appear.md diff --git a/.changeset/beige-tools-appear.md b/.changeset/beige-tools-appear.md new file mode 100644 index 000000000..87277733e --- /dev/null +++ b/.changeset/beige-tools-appear.md @@ -0,0 +1,5 @@ +--- +"@react-pdf/render": patch +--- + +fix: stroke dash array computation diff --git a/packages/render/src/primitives/renderSvg.js b/packages/render/src/primitives/renderSvg.js index a30f936a0..d4c0b26ae 100644 --- a/packages/render/src/primitives/renderSvg.js +++ b/packages/render/src/primitives/renderSvg.js @@ -53,7 +53,7 @@ const setLineCap = (ctx, node) => { const setLineDash = (ctx, node) => { const value = node.props?.strokeDasharray || null; - if (value) ctx.dash(value.split(',').map(Number)); + if (value) ctx.dash(value.split(/[\s,]+/).map(Number)); }; const hasLinearGradientFill = (node) =>