Skip to content

🎥 Make videos programmatically with React

fix: fix `findLastIndex` typeScript error

lw1be35156e823
diff --git a/packages/layout-utils/src/layouts/fill-text-box.ts b/packages/layout-utils/src/layouts/fill-text-box.ts
index 33344a556f..eec223254a 100644
--- a/packages/layout-utils/src/layouts/fill-text-box.ts
+++ b/packages/layout-utils/src/layouts/fill-text-box.ts
@@ -31,7 +31,7 @@ export const fillTextBox = ({
exceedsBox: boolean;
newLine: boolean;
} => {
- const lastLineIndex = lines.findLastIndex(l => l.length > 0);
+ const lastLineIndex = lines.reverse().findIndex(l => l.length > 0);
const currentlyAt = lastLineIndex === -1 ? 0 : lastLineIndex;
const lineToUse = lines[currentlyAt];