Skip to content

White space in style causes confusing error, Cannot read properties of null (reading 'value') #2360

@Scong

Description

@Scong

Describe the bug

if a style is specified as ' rgb(255, 255, 0)' an error will occur
Cannot read properties of null (reading 'value'), I've gotten around this by trimming the style value.

To Reproduce
image

const Quixote = () => (


<Text style={{color: " rgb(255, 255, 0)"}} fixed>
~ Created with react-pdf ~



);

ReactPDF.render();

Expected behavior
Either a better error to occur or the CSS to be parsed, an extra space should not invalidate the CSS.

Desktop (please complete the following information):

  • OS: MACOS
  • Browser [read renderer / Node]
  • React-pdf version "@react-pdf/renderer": "^3.1.12",

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions