Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/famous-hounds-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-pdf/stylesheet": patch
---

fix: change the widthMatch typechecking method in borders resolve helper.
7 changes: 5 additions & 2 deletions packages/stylesheet/src/resolve/borders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ const resolveBorderShorthand = <K extends BorderKey>(

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 {
Expand Down