feat(mobile): MIKRO POLISH-2 cyklande laddningsmeddelanden på scan-väntan

This commit is contained in:
Sven (AAMOS AI)
2026-08-17 21:17:24 +07:00
parent b1a93be974
commit 653f94de86
2 changed files with 13 additions and 3 deletions
+12 -2
View File
@@ -1,4 +1,5 @@
import type { PropsWithChildren, ReactNode } from "react";
import { useEffect, useState } from "react";
import {
ActivityIndicator,
KeyboardAvoidingView,
@@ -204,11 +205,20 @@ export function ProgressBar({
);
}
export function LoadingView() {
export function LoadingView({ messages }: { messages?: string[] } = {}) {
const [i, setI] = useState(0);
const list = messages ?? [];
useEffect(() => {
setI(0);
if (list.length <= 1) return;
const id = setInterval(() => setI((v) => (v + 1 < list.length ? v + 1 : v)), 1800);
return () => clearInterval(id);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [list.length]);
return (
<View style={styles.center}>
<ActivityIndicator size="large" color={colors.primary} />
<Small>{t("common.loading")}</Small>
<Small>{list.length ? list[i] : t("common.loading")}</Small>
</View>
);
}