-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for React 18 #1879
Add support for React 18 #1879
Conversation
Hi, I am trying to use your library on a react v18 project, but I cannot resolve the conflicts. |
@maguro97 Until an official version appears, you can make it work by doing |
@diegomura Please check this pull request and add the support for react 18, this will be helpful. Thanks |
👍🏼 |
Hi! Can you tell me approximately when is this going to be merged? |
Please, I really need this |
@diegomura we have 2 approvals here. do we have an approximate date for this PR merge? thank you |
Please let me know if there is a chance for PR by the end of this week (15 Aug). Thanks |
Just updated to React 18 |
This would be great to be accepted as fast as possible :D |
Admin, please merge this PR. Its very needed. The earlier the better |
@diegomura please there are 2 approvals already for this PR. Kindly merge. I really need this package to complete a project. Thanks |
Not sure what is taking so long on this PR. 🙄 |
Really considering to fork this and publish it under a different name until this is merged. And of course, remove it after. |
@vrinceanuv please do |
wating. thank you |
Does it support react 18 yet? |
@diegomura is there an estimation when this will be merged? |
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. |
@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? |
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.
Installation command: $ npm install @react-18-pdf/renderer --save
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:
|
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? |
Looking forward for some info about it as well |
Looking forward to it as well, currently having to use craco to use this in my react 18 app. |
Still waiting... |
Sadly I have other dependencies which are already on Thanks! |
Have you tried the one for React 18?
|
Getting this error
|
I have the same issue. |
For me npm install @react-pdf/renderer --legacy-peer-deps works. It installs with ^3.0.0 version. Of course it does not have documented features like pageMode or pageNumber (props on Document and Page) so I had to install 2 packages. @react-pdf/renderer for creating the pdf (create pdf model using Document, Page, View, Text, Image etc. components). Then I can get the pdf using usePDF hook. @react-pdf package for displaying the pdf and access to pageMode and pageNumber props on its Document and Page components. It renders the pdf by passing pdf generated by first package to the Document component using 'file' prop. |
Thanks for the tip dude you help me a lot! |
could you share a gist on how you do this? @LimaoCode |
Here is a gist of how to combine those 2 packages to have fully functional react pdf rendering. https://gist.github.com/dbojarski/f4b8af4a3f6a631e720ee3b4de3294fb |
Any update about this merge? |
I ran I am on I am getting this error
and
|
Hey @diegomura, Would be very grateful, If you could take a look at this issue in you're spare time and release an alpha or beta version until a stable version is released. |
I was able to fix this by manually installing the events package. |
@simonurmi thanks for the quick fix. Can you tell me how this library fix the issue? |
It's trying to read property call of EventEmitter, which is undefined. EventEmitter is part of the events package. I just tried installing it and it worked. I'm also working with Vite. My guess is that events is missing as a peerDependency in react-pdf, and in other build tools it's bundled in through some other way. TL;DR events is probably missing as a peerDependency |
@simonurmi thanks everything work fine after following your advice |
Hi all. Was someone able to validate this still works for React 17? I didn't have time, but I have doubts wether will work. Tbh I didn't have enough time to find what's the best way to have this lib working for at least 17 and 18. Alpha versions are an option, but that would be a nightmare to maintain, test and publish, as would require cherry-picking commits in both versions and therefore fork this project in 2. |
Hey, I was able to install and run this lib with react 18 by adding these overrides to my
Be aware that as stated by this comment, "the overrides property is only honored when running npm install first time". I guess this could serve as a temp fix while we're waiting for this PR to be merged or another solution to be provided. |
@diegomura One standard practice would be to create a major version release for React 18 compatibility and add the following documentation:
I would be more than happy to help write an upgrade guide. This library is amazing, however if it doesn't become compatible with React 18 and later versions, users will default to a third-party fork that does, and that'll just be a nightmare for all of us. Btw thanks a ton for this package :) Really great experience working with the docs and PDF components. |
Hi, any news on this PR? |
Any movement on this? Would love to get official React 18 support :) |
Hi everyone, I got
I documented those two things in detail in the following gist: And I demonstrated them in the following video (the demo begins at the 1:20 mark):
|
i did some digging into this. to make the specs pass we need to provide a root document - this is part of how react 18 works but i haven't been able to find any custom renderers that have implemented this so i'm unsure of what's required. the above change is not backwards compatible so a major version bump would be required and going forward react-pdf would have to only support react >=18 |
closed in favor of #2140 |
Thank you! I have come back to this package every few weeks hoping it worked out of the box on React 18+ but hadn't found a solution yet. Adding events as a dependency made the package finally work for me. package.json
Pipeline:
It should also be noted that the README uses StylesSheet.create() which is a react native function. To make everything build properly, the stylesheets can be created inline as a JS object.
|
No description provided.