mirror of
http://88.130.71.182:3000/BlitTech/contexta_mb.git
synced 2026-06-12 23:23:22 +00:00
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import { ActivityIndicator, View, StyleSheet, Text } from 'react-native';
|
|
import { COLORS, FONT_SIZE, SPACING } from '../../theme';
|
|
import { useTheme } from '../../theme';
|
|
|
|
interface SpinnerProps {
|
|
size?: 'small' | 'large';
|
|
color?: string;
|
|
centered?: boolean;
|
|
label?: string;
|
|
}
|
|
|
|
export function Spinner({ size = 'large', color, centered = false, label }: SpinnerProps) {
|
|
const { theme } = useTheme();
|
|
const spinnerColor = color ?? COLORS.primary;
|
|
|
|
if (centered) {
|
|
return (
|
|
<View style={styles.centered}>
|
|
<ActivityIndicator size={size} color={spinnerColor} />
|
|
{label ? <Text style={[styles.label, { color: theme.textSecondary }]}>{label}</Text> : null}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
return <ActivityIndicator size={size} color={spinnerColor} />;
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
centered: {
|
|
flex: 1,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
padding: SPACING.xxxl,
|
|
gap: SPACING.md,
|
|
},
|
|
label: { fontSize: FONT_SIZE.sm },
|
|
});
|