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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
error Cannot read properties of undefined (reading 'height') at setNodeHeight #1602
Comments
I also got this error. After trying out a lot of stuff, I realised that the extra ";" outside the Text and inside the View component was the reason for the error. <View>
<Text>some text</Text>;
</View> |
try { name ? <Text>{name}</Text> : null } 馃憠馃徎 repl |
In my case I just copied some example from docs and forgot to wrap the next inside I had: const MyDoc = (
<Document>
<Page size="A4">
My document data
</Page>
</Document>
); But it should be: const MyDoc = (
<Document>
<Page size="A4">
<Text>My document data</Text>
</Page>
</Document>
); |
You should just add styles to Text const Component = ({ name }) => {
return (
<>
{name &&
<Text style={{height: 50}}>
{name}
</Text>}
</>
);
}
<Component name='' /> |
Guess problem is that u wrap component with React.Fragment(<></>) - PDF does not understand what is that. |
Example above cause fatal errors in
@react-pdf
, but it should render nothing.馃憠馃徎 repl
Discussed in #1599
Originally posted by joseDaKing November 17, 2021
I get this error in my code and I don't why
error:
TypeError: Cannot read properties of undefined (reading 'height')
at setNodeHeight
The text was updated successfully, but these errors were encountered: