CityTrack / User /src /components /ui /Loader.tsx
0xarchit's picture
User app beta v1 complete
71638d4
import React from 'react';
import { View, ActivityIndicator, StyleSheet, ViewStyle } from 'react-native';
import { colors } from '../../theme';
interface LoaderProps {
size?: 'small' | 'large';
color?: string;
style?: ViewStyle;
fullScreen?: boolean;
}
export const Loader: React.FC<LoaderProps> = ({
size = 'small',
color = colors.primary.main,
style,
fullScreen = false
}) => {
if (fullScreen) {
return (
<View style={[styles.fullScreen, style]}>
<ActivityIndicator size={size} color={color} />
</View>
);
}
return (
<View style={[styles.container, style]}>
<ActivityIndicator size={size} color={color} />
</View>
);
};
const styles = StyleSheet.create({
container: {
justifyContent: 'center',
alignItems: 'center',
padding: 10,
},
fullScreen: {
...StyleSheet.absoluteFillObject,
backgroundColor: 'rgba(255,255,255,0.8)',
justifyContent: 'center',
alignItems: 'center',
zIndex: 999,
},
});