From ab800fadd256ac555b2b14fbe4c7c3b9d3e817a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kostrzyn=CC=81ski?= Date: Mon, 7 Apr 2025 14:58:49 +0200 Subject: [PATCH 1/4] fix: change the widthMatch typechecking method in borders resolve helper. --- packages/stylesheet/src/resolve/borders.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/stylesheet/src/resolve/borders.ts b/packages/stylesheet/src/resolve/borders.ts index 183cb3eaf..7d22333b4 100644 --- a/packages/stylesheet/src/resolve/borders.ts +++ b/packages/stylesheet/src/resolve/borders.ts @@ -30,7 +30,10 @@ const resolveBorderShorthand = ( const style = styleMatch as BorderStyleValue; const color = colorMatch ? transformColor(colorMatch as string) : undefined; - const width = widthMatch ? transformUnit(container, widthMatch) : undefined; + const width = + typeof widthMatch !== 'undefined' + ? transformUnit(container, widthMatch) + : undefined; if (key.match(/(Top|Right|Bottom|Left)$/)) { return { From 0be06c0ffc0a3208f4c01ba3b804024e1b51cedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kostrzy=C5=84ski?= Date: Mon, 7 Apr 2025 15:01:19 +0200 Subject: [PATCH 2/4] Create famous-hounds-dream.md --- .changeset/famous-hounds-dream.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/famous-hounds-dream.md diff --git a/.changeset/famous-hounds-dream.md b/.changeset/famous-hounds-dream.md new file mode 100644 index 000000000..3484a0620 --- /dev/null +++ b/.changeset/famous-hounds-dream.md @@ -0,0 +1,5 @@ +--- +"@react-pdf/stylesheet": patch +--- + +fix: change the widthMatch typechecking method in borders resolve hel… From 29716498a204e96c12ebfe34efc5725807989fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kostrzy=C5=84ski?= Date: Mon, 7 Apr 2025 15:02:20 +0200 Subject: [PATCH 3/4] Update famous-hounds-dream.md --- .changeset/famous-hounds-dream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/famous-hounds-dream.md b/.changeset/famous-hounds-dream.md index 3484a0620..24a838161 100644 --- a/.changeset/famous-hounds-dream.md +++ b/.changeset/famous-hounds-dream.md @@ -2,4 +2,4 @@ "@react-pdf/stylesheet": patch --- -fix: change the widthMatch typechecking method in borders resolve hel… +fix: change the widthMatch typechecking method in borders resolve helper. From c34c4fe27cda5ffb7da3c5b3ed395874f38c5f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kostrzyn=CC=81ski?= Date: Mon, 7 Apr 2025 15:17:53 +0200 Subject: [PATCH 4/4] fix: set a default for styleMatch, in case of the "shorthand" value being set to 0. --- packages/stylesheet/src/resolve/borders.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stylesheet/src/resolve/borders.ts b/packages/stylesheet/src/resolve/borders.ts index 7d22333b4..6dfa4d56a 100644 --- a/packages/stylesheet/src/resolve/borders.ts +++ b/packages/stylesheet/src/resolve/borders.ts @@ -25,7 +25,7 @@ const resolveBorderShorthand = ( if (match) { const widthMatch = match[1] || value; - const styleMatch = match[4] || value; + const styleMatch = match[4] || value || 'solid'; const colorMatch = match[5] || value; const style = styleMatch as BorderStyleValue;