react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

The text has the wrong width in flexbox layouts with columns

Open jeetiss opened this issue 3 years ago • 3 comments

Describe the bug

The text has the wrong width in flexbox layouts with columns

To Reproduce

go to repl

Expected behavior

The text should be in the colored block

Screenshots

Снимок экрана 2022-06-07 в 15 57 36

I dug into the issue a little bit and the text component has debug box with the right width, so I think the problem is in the @react-pdf/render or @react-pdf/textkit package.

Desktop (please complete the following information):

  • React-pdf version 2.2.0

jeetiss avatar Jun 07 '22 13:06 jeetiss

Thanks. Is this something introduced in the last version or it works the same in older ones? I'll try to take a look

diegomura avatar Jun 07 '22 14:06 diegomura

Yep, it was broken in one of the latest versions

jeetiss avatar Jun 07 '22 17:06 jeetiss

For some reason, yoga calls measureText with full-page width firstly and after the real width is here but lines are already calculated and saved to the node. Any ideas why yoga adds a measureText call?

https://github.com/diegomura/react-pdf/blob/master/packages/layout/src/text/measureText.js#L22-L33

jeetiss avatar Jun 09 '22 12:06 jeetiss

as duplicate of #2182

jeetiss avatar Feb 07 '23 07:02 jeetiss