Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix: add conditional flex:1 for nested list content to fix layout (#3198)

Diego Vega Centenofa4c8adf78e7
diff --git a/packages/pdf/src/templates/shared/rich-text.tsx b/packages/pdf/src/templates/shared/rich-text.tsx
index 91d35ac92..959606897 100644
--- a/packages/pdf/src/templates/shared/rich-text.tsx
+++ b/packages/pdf/src/templates/shared/rich-text.tsx
@@ -128,6 +128,15 @@ export const RichText = ({ children }: RichTextProps) => {
</PdfText>
);
+ let hasNestedList = false;
+ if (Array.isArray(children)) {
+ hasNestedList = children.some(
+ (child) =>
+ child?.props?.element?.rawTagName === "ul" ||
+ child?.props?.element?.rawTagName === "ol",
+ );
+ }
+
// Same BiDi-injection trick as the <p> renderer — see applyRtlDirectionRecursively.
const contentNode = rtl ? (
<PdfText
@@ -155,7 +164,7 @@ export const RichText = ({ children }: RichTextProps) => {
>
<View style={{ flexDirection: "row", alignItems: "flex-start" }}>
{markerNode}
- {children}
+ <View style={hasNestedList ? { flex: 1 } : {}}>{children}</View>
</View>
</View>
);