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

This commit is contained in:
Diego Vega Centeno
2026-07-03 14:22:03 -05:00
committed by GitHub
parent 5b8ab33888
commit fa4c8adf78
@@ -128,6 +128,15 @@ export const RichText = ({ children }: RichTextProps) => {
</PdfText> </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. // Same BiDi-injection trick as the <p> renderer — see applyRtlDirectionRecursively.
const contentNode = rtl ? ( const contentNode = rtl ? (
<PdfText <PdfText
@@ -155,7 +164,7 @@ export const RichText = ({ children }: RichTextProps) => {
> >
<View style={{ flexDirection: "row", alignItems: "flex-start" }}> <View style={{ flexDirection: "row", alignItems: "flex-start" }}>
{markerNode} {markerNode}
{children} <View style={hasNestedList ? { flex: 1 } : {}}>{children}</View>
</View> </View>
</View> </View>
); );