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

Add support for React 18

Open rasmusrim opened this issue 2 years ago • 32 comments

rasmusrim avatar Jun 08 '22 12:06 rasmusrim

Hi, I am trying to use your library on a react v18 project, but I cannot resolve the conflicts. Is there any way to use the library with react v18? Is official support for this version planned anytime soon?

maguro97 avatar Jun 11 '22 16:06 maguro97

@maguro97 Until an official version appears, you can make it work by doing npm i --legacy-peer-deps

rasmusrim avatar Jun 13 '22 06:06 rasmusrim

@diegomura Please check this pull request and add the support for react 18, this will be helpful. Thanks

Sumitroy12 avatar Jul 01 '22 01:07 Sumitroy12

👍🏼

jscastanos avatar Jul 19 '22 03:07 jscastanos

Hi! Can you tell me approximately when is this going to be merged?

alekzajic avatar Jul 25 '22 11:07 alekzajic

Please, I really need this

bsrodrigue avatar Aug 03 '22 16:08 bsrodrigue

@diegomura we have 2 approvals here. do we have an approximate date for this PR merge? thank you

vrinceanuv avatar Aug 08 '22 08:08 vrinceanuv

Please let me know if there is a chance for PR by the end of this week (15 Aug). Thanks

lucastes avatar Aug 09 '22 08:08 lucastes

Just updated to React 18 When will this PR be merged??

MarkForLoop avatar Aug 10 '22 16:08 MarkForLoop

This would be great to be accepted as fast as possible :D

PauloFavero avatar Aug 17 '22 03:08 PauloFavero

Admin, please merge this PR. Its very needed. The earlier the better

DonSmog avatar Aug 18 '22 21:08 DonSmog

@diegomura please there are 2 approvals already for this PR. Kindly merge. I really need this package to complete a project. Thanks

DonSmog avatar Aug 19 '22 07:08 DonSmog

Not sure what is taking so long on this PR. :roll_eyes:

tempo156a avatar Aug 19 '22 08:08 tempo156a

Really considering to fork this and publish it under a different name until this is merged. And of course, remove it after.

vrinceanuv avatar Aug 19 '22 09:08 vrinceanuv

@vrinceanuv please do

for-hope avatar Aug 19 '22 16:08 for-hope

wating. thank you

ShaiMahnai avatar Aug 21 '22 15:08 ShaiMahnai

Does it support react 18 yet?

Elelan avatar Aug 21 '22 16:08 Elelan

@diegomura is there an estimation when this will be merged?

florian-heer avatar Aug 29 '22 14:08 florian-heer

Can someone validate if this does not break support for React 16 or 17? We can drop 16, although Im sure a lot of people still use it. But for 17 we should still provide support. I remember the reconciler bump had issues with it. Sorry for the delay. I don't have enough time these days to test and merge everything 😄

diegomura avatar Aug 30 '22 14:08 diegomura

Can someone validate if this does not break support for React 16 or 17? We can drop 16, although Im sure a lot of people still use it. But for 17 we should still provide support. I remember the reconciler bump had issues with it. Sorry for the delay. I don't have enough time these days to test and merge everything 😄

@diegomura, could we have an alpha/beta version with those changes to test in our projects? I can try to test it with React 16, 17 and 18, and give some feedback.

DercilioFontes avatar Aug 31 '22 02:08 DercilioFontes

@rasmusrim do you have any information on diegomura's comment, if this PR is breaking react 17 compatibility or if it supports it, if you have tested it?

LB22 avatar Aug 31 '22 21:08 LB22

Can someone validate if this does not break support for React 16 or 17?

For anyone considering testing this branch in React 16 or 17, the author of the branch posted a comment (linked below) containing a link to an NPM package (also linked below) that I assume contains the changes in this branch.

  • Comment: https://github.com/diegomura/react-pdf/issues/1878#issuecomment-1230157669
  • NPM package: https://www.npmjs.com/package/@react-18-pdf/renderer

Installation command:

$ npm install @react-18-pdf/renderer --save

~~That @react-18-pdf/renderer NPM package installed OK in my environment (a React 18 environment bootstrapped with CRA v5).~~

Edit: It installed OK, but I could no longer build my app.


Installation aside, I don't know what "validating whether this branch breaks support for React 16 or 17" would involve. Some ideas I have of things that could be checked are:

  • [ ] Does it install without errors
  • [ ] Are there any specific things the project maintainer wants people to test
  • [ ] Can I create an empty PDF
  • [ ] Can I create a PDF that contains all of the various element types offered by this project (e.g. text, images, SVG)
  • [ ] Can I view a PDF
  • [ ] Do all the automated tests in this project pass (I don't know whether there are any)
  • [ ] Can I download a PDF

~~Anyway, at this point, I don't plan on doing that validation work. I don't use React 16 or 17 on my projects.~~ I am willing to do some of the validation work, provided I know what the specific validation criteria are (i.e. "what done looks like" to person who would be deciding whether or not to merge this branch).

gitname avatar Sep 11 '22 20:09 gitname

Installation aside, I don't know what "validating whether this branch breaks support for React 16 or 17" would involve.

  • [ ] Are there any specific things the project maintainer wants people to test

Hi @diegomura, is there a documented "test/validation procedure" for this project; e.g. a checklist that someone goes through when making major changes to the project, in order to detect regressions? If not, are there specific things you suggest people test in order to validate whether this branch breaks support for React 16 or 17?

gitname avatar Sep 11 '22 20:09 gitname

Hi @diegomura is there any update about this merge?

devq97 avatar Sep 12 '22 18:09 devq97

Looking forward for some info about it as well

vnevermore avatar Sep 13 '22 18:09 vnevermore

Looking forward to it as well, currently having to use craco to use this in my react 18 app.

themetzmeier avatar Sep 13 '22 21:09 themetzmeier

Still waiting...

dbojarski avatar Sep 20 '22 17:09 dbojarski

Sadly npm i --legacy-peer-deps true doesnt work & gives a Cannot create property '_updatedFibers' on number '0' at requestUpdateLane error. Any workaround this for now?

I have other dependencies which are already on 18.2.0 version so I cant roll back either 😬

Thanks!

krishna-404 avatar Sep 21 '22 12:09 krishna-404

Sadly npm i --legacy-peer-deps true doesnt work & gives a Cannot create property '_updatedFibers' on number '0' at requestUpdateLane error. Any workaround this for now?

I have other dependencies which are already on 18.2.0 version so I cant roll back either 😬

Thanks!

Have you tried the one for React 18?

npm install @react-18-pdf/renderer --save

DercilioFontes avatar Sep 21 '22 14:09 DercilioFontes

Have you tried the one for React 18?

npm install @react-18-pdf/renderer --save

Getting this error

node_modules/@react-18-pdf/layout/lib/index.es.js:20:17: Cannot resolve dependency '@react-18-pdf/yoga'
  18 | import resolveImage from '@react-18-pdf/image';
  19 | import flatten from '@react-18-pdf/stylesheet/lib/flatten';
> 20 | import Yoga from '@react-18-pdf/yoga';
     |                 ^

krishna-404 avatar Sep 21 '22 20:09 krishna-404