mojmajstor/components/ui/loading.tsx
2026-06-06 03:54:22 +02:00

69 lines
1.7 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { View, ActivityIndicator } from "react-native";
import { useTheme } from "../theme";
interface LoadingProps {
fullScreen?: boolean;
skeleton?: boolean;
}
export function Loading({ fullScreen = false, skeleton = false }: LoadingProps) {
const theme = useTheme();
if (skeleton) {
return (
<View
accessible
accessibilityLabel="Се вчитува"
accessibilityRole="progressbar"
style={{ gap: theme.spacing.md }}
>
<View
style={{
backgroundColor: theme.colors.surfaceAlt,
borderRadius: theme.radius.lg,
height: 130,
opacity: 0.55,
}}
/>
<View
style={{
backgroundColor: theme.colors.surfaceAlt,
borderRadius: theme.radius.md,
height: 18,
width: "65%",
opacity: 0.55,
}}
/>
<View
style={{
backgroundColor: theme.colors.surfaceAlt,
borderRadius: theme.radius.md,
height: 14,
width: "45%",
opacity: 0.55,
}}
/>
<View
style={{
backgroundColor: theme.colors.surfaceAlt,
borderRadius: theme.radius.md,
height: 90,
opacity: 0.55,
}}
/>
</View>
);
}
return (
<View
accessible
accessibilityLabel="Се вчитува"
accessibilityRole="progressbar"
style={[{ alignItems: "center", justifyContent: "center" }, fullScreen && { flex: 1 }]}
>
<ActivityIndicator size="large" color={theme.colors.primary} />
</View>
);
}