-
-
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
Conditional Rendering #2957
Comments
Can you provide what those variables values are? Can't reproduce without that |
I am trying to debug my code now, this doesn't seem to be the issue after all. |
I was unable to pinpoint which section of code caused the problem. I rolled back to 4.02, the issue was still there. I rolled back to 4.0.0 and it was solved. The entire chain of events is a little difficult to explain as my PDF takes in a lot of data. The user can input/delete text, the text gets turned into an array of objects and gets sent to the PDF. |
Sorry to hear that, but I don't know what to say then :) What version of React are you using?
Can you inspect your bundle and check what's that thing it's trying to read return from? |
I also had the same issue, also with a quite complex PDF. I was conditionally rendering parts of a document with data coming from a form. // ... other components
{summary && summary.length && (
<View style={[styles.section, styles.flatSection]}>
<Text style={styles.flatSectionTitle}>Summary</Text>
<Text style={styles.flatSectionView}>{summary}</Text>
</View>
)} Using the // ... other components
<View
wrap={false}
render={() => {
if (summary && summary.length) {
return (
<View style={[styles.section, styles.flatSection]}>
<Text style={styles.flatSectionTitle}>Summary</Text>
<Text style={styles.flatSectionView}>{summary}</Text>
</View>
);
}
}}
/> but it's causing another problem: #2476 I'm using Next.js 14, should I try to create a minimal reproducible example? |
had almost the same error message
the problem in this function:
in my case this error was when I tried put undefined/broken View data in PDFDownloadLink or PDFPreview |
Could this be caused by the fact that when // Renders nothing if myNumber === 0
{ myNumber > 0 && <MyComponent /> } instead of // Renders 0 if myNumber === 0
{ myNumber && <MyComponent /> } |
yep @Jussinevavuori , my bad. But the issue still stands, even when I use proper conditionals. It might be an issue on my part, but it used to work in version |
Hey guys, newbie developer here. Same issue is happening with me. Let's say I have a document from a database that is split into chunks like [Paragraph: string] If the string or array is one of the following: Here is an example that will work if you DO have text but not if you DO NOT have text. I tried to display an empty string or array and it still throws the error.
Tried reverting from 4.0.2 to 4.0.0 and error still persists Soft fix is to have absolutely filled out or have my database have default values with truthy stuff in it. Edit: Reverted to 3.4.5 and it works now yay |
Hi, My case is not so complex, but I encounter an error with versions above 4.0.0.
|
i'm getting the same error as others, but it is happening when calling the i've further narrowed it down to specifically version 4.0.2 that breaks it? for my case anyway, 4.0.1 works fine |
Describe the bug
When re-rendering a changed array, I got an error: @react-pdf_renderer.js?v=a9501a5f:98100 Uncaught TypeError: Cannot read properties of undefined (reading 'return')
To Reproduce
Here is the code that seems to have caused the bug:
Expected behavior
It should update without crashing
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: