diff --git a/.changeset/famous-hounds-dream.md b/.changeset/famous-hounds-dream.md new file mode 100644 index 000000000..24a838161 --- /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 helper. diff --git a/packages/stylesheet/src/resolve/borders.ts b/packages/stylesheet/src/resolve/borders.ts index 183cb3eaf..6dfa4d56a 100644 --- a/packages/stylesheet/src/resolve/borders.ts +++ b/packages/stylesheet/src/resolve/borders.ts @@ -25,12 +25,15 @@ 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; 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 {