fix(pdf): resolve crash in yoga engine caused by absolute positioning and empty paragraphs

This commit is contained in:
2026-04-21 13:46:38 +02:00
parent 529696ba8e
commit 06dac33ef8
17 changed files with 7214 additions and 48 deletions

View File

@@ -1,3 +1,4 @@
import React from 'react';
/* eslint-disable react/prop-types */
import { Document, Page, View, Text, StyleSheet, Link, Image } from '@react-pdf/renderer';
@@ -240,6 +241,7 @@ const renderLexicalNode = (node: any, idx: number): React.ReactNode => {
}
case 'paragraph': {
if (!node.children || node.children.length === 0) return null;
return (
<Text key={idx} style={styles.paragraph}>
{node.children?.map((child: any, i: number) => renderLexicalNode(child, i))}
@@ -248,6 +250,7 @@ const renderLexicalNode = (node: any, idx: number): React.ReactNode => {
}
case 'heading': {
if (!node.children || node.children.length === 0) return null;
let hStyle = styles.heading3;
let isH1 = false;
if (node.tag === 'h1') {
@@ -274,6 +277,7 @@ const renderLexicalNode = (node: any, idx: number): React.ReactNode => {
}
case 'list': {
if (!node.children || node.children.length === 0) return null;
return (
<View key={idx} style={styles.list}>
{node.children?.map((child: any, i: number) => {
@@ -365,7 +369,7 @@ export const PDFPage: React.FC<PDFPageProps> = ({ page, locale = 'de' }) => {
</View>
{/* Industrial footer with page numbers */}
<View style={styles.footer} fixed>
<View style={{ ...styles.footer, position: 'absolute', bottom: 30, height: 40 }} fixed>
<View style={styles.footerInfo}>
<Text style={styles.footerBrand}>KLZ VERTRIEBS GMBH</Text>
<Text style={styles.footerText}>