Closed Lilian1331 closed 3 years ago
What version of React are you using?
What version of React are you using?
I am using "react": "16.7.0",
Oh. Wait. Not sure if that's what causing this, but you cannot render a text directly inside a <Page>
. You must always use <Text>
:
import { PDFDownloadLink, Document, Page, Text } from '@react-pdf/renderer'
const MyDoc = () => (
<Document>
<Page>
<Text>ABC</Text>
</Page>
</Document>
)
Let me know if that solves your issue
Oh. Wait. Not sure if that's what causing this, but you cannot render a text directly inside a
<Page>
. You must always use<Text>
:import { PDFDownloadLink, Document, Page, Text } from '@react-pdf/renderer' const MyDoc = () => ( <Document> <Page> <Text>ABC</Text> </Page> </Document> )
Let me know if that solves your issue
Thanks, but the issue cannot be solved. Am I missing some configurations? Or I can't directly put the <PDFDownloadLink>
inside the render function?
I have some doubts about your code that makes me thing that maybe this is not even a react-pdf issue. All errors are from react-reconciler
, which is used by react-pdf
but also by react
itself
divs
at the same level without any parent. Is this something you can do with React now?I just tried on my end and everything is working fine. Please try this:
const MyDoc = () => (
<Document>
<Page>
<Text>ABC</Text>
</Page>
</Document>
)
class App extends React.Component {
render() {
return (
<div> // or Fragment if you want
<div>Export</div>
<div>
<PDFDownloadLink document={<MyDoc />} fileName="somename.pdf">
{({ loading }) => loading ? 'Loading' : 'Download'}
</PDFDownloadLink>
</div>
</div>
)
}
}
Yes I have the exact same code as yours. Same error alerted.
And I just created a new project and do npm install @react-pdf/renderer
again.
Other error pops up
Really thanks for the help!
That last error is due to https://github.com/diegomura/react-pdf/commit/9d8903ed73bcbcd3e01065635d81225901cbdcaa
Will be published in next version. The other issue had nothing to do with it, and seems to me that does not occur anymore. Going to publish the new version now and please try with it
@diegomura I'm seeing this error too (the initial one, with getCurrentStack) when using webpack with mode=development, however, it goes away with mode=production.
same issue
same issue here
same issue, the problem is still there @diegomura
Hi, is there any chances to fix that at any times ? I can't get that work in Reactjs.net environment @diegomura .
Hi @diegomura
Using exactly same code as yours just to create sample one but still no luck
Error: Cannot set property 'getCurrentStack' of undefined
Can you please suggest
installed the version 1.6.9 and created a sample application and encountering this error am not sure if this issue was fixed
Can you please suggest any solution here
For the ones getting this error, do you mind checking what React version are you using? I still suspect there's something conflicting with the React version since the error is on react-reconciler
Hello @diegomura Am using "react": "16.8.5", version, "react-dom": "16.8.5", Can you please suggest any solution to address the issue
Can you provide a way to replicate it? I would be happy to fix this but I as I said above, I can't replicate it on my side
Hello @diegomura , Thanks for your reply
am creating a spfx webpart
following is the reference:
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part
then am installing the react-pdf package using "npm i @react-pdf/renderer"
then am adding a small piece of code
<PDFDownloadLink document={
your help on this would be highly valuable for me here
But you are not providing any document into the document
prop in there. Do you mind expanding?
@diegomura I was having the same problem.
I think it's because he might be saving the pdf with the
Anyway it hangs without any message when I trying to print a small test message.
const MyDoc = () => (
<Document>
<Page>
<Text>Hellow World</Text>
</Page>
</Document>
)
Is there any special thing to do in SPFx?
@Fareedbaba Did you managed to solve your issue?
PS: Digging in to the loop I find the same error "Cannot set property 'getCurrentStack' of undefined"
function resetCurrentFiber() {
{
ReactDebugCurrentFrame.getCurrentStack = null;
current = null;
phase = null;
}
}
ReactDebugCurrentFrame is undefined and that's why it throws the error.
This error only append in debug mode. So, I deployed it to prod and works a little better. It shows a download link and if it is clicked it redirects the user to https://contoso.sharepoint.com/sites/Sitename/blob:/50fe4a02-5d0d-44e9-9970-c9a3e088dbae
And since SharePoint does not recognize that page it throws a page not found
Can someone test if this persist on 2.0? Thank you!!
I still cannot replicate it. Any help from someone who can test it? Or someone who provides a valid snippet to replicate it?
Similar to @Dangerous-Mind experience, this has started to pop up in a project of mine as well. In our case it was related to us loading an production build of react and setting the env to development.
Thus causing the error inside of the react-reconciler. So at least in our case it wasn't a bug of pdf-react.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
There is a issue when I apply "On the fly rendering" in my react webpage. https://react-pdf.org/advanced#on-the-fly-rendering
then inside the react export class:
it gives me this error![image](https://user-images.githubusercontent.com/23545532/56053669-49b3d080-5d87-11e9-8111-29bd43b79207.png)
Any help thanks.