/* * File: LoadingState.tsx * Description: Loading state component for patient data fetching * Design & Developed by Tech4Biz Solutions * Copyright (c) Spurrin Innovations. All rights reserved. */ import React from 'react'; import { View, Text, ActivityIndicator, StyleSheet, } from 'react-native'; import { theme } from '../../../theme/theme'; import Icon from 'react-native-vector-icons/Feather'; // ============================================================================ // INTERFACES // ============================================================================ interface LoadingStateProps { title?: string; subtitle?: string; showIcon?: boolean; iconName?: string; size?: 'small' | 'large'; } // ============================================================================ // LOADING STATE COMPONENT // ============================================================================ /** * LoadingState Component * * Purpose: Display loading state during data fetching * * Features: * - Customizable loading messages * - Optional icon display * - Different sizes (small/large) * - Centered layout with spinner * - Medical-themed design */ const LoadingState: React.FC = ({ title = 'Loading...', subtitle = 'Please wait while we fetch the data', showIcon = true, iconName = 'loader', size = 'large', }) => { // ============================================================================ // RENDER HELPERS // ============================================================================ /** * Render Large Loading State * * Purpose: Render full-screen loading state */ const renderLargeState = () => ( {/* Loading Animation */} {showIcon && ( )} {/* Loading Text */} {title} {subtitle} ); /** * Render Small Loading State * * Purpose: Render compact loading state */ const renderSmallState = () => ( {title} ); // ============================================================================ // MAIN RENDER // ============================================================================ return size === 'large' ? renderLargeState() : renderSmallState(); }; // ============================================================================ // STYLES // ============================================================================ const styles = StyleSheet.create({ // Large Loading State container: { flex: 1, justifyContent: 'center', alignItems: 'center', paddingHorizontal: theme.spacing.xl, paddingVertical: theme.spacing.xxl, backgroundColor: theme.colors.background, }, loadingContainer: { position: 'relative', marginBottom: theme.spacing.lg, }, iconContainer: { position: 'absolute', top: '50%', left: '50%', marginTop: -16, marginLeft: -16, zIndex: 1, }, spinner: { transform: [{ scale: 1.5 }], }, title: { fontSize: 20, color: theme.colors.textPrimary, fontFamily: theme.typography.fontFamily.bold, textAlign: 'center', marginBottom: theme.spacing.sm, }, subtitle: { fontSize: 16, color: theme.colors.textSecondary, fontFamily: theme.typography.fontFamily.regular, textAlign: 'center', lineHeight: 24, }, // Small Loading State smallContainer: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', paddingVertical: theme.spacing.md, }, smallSpinner: { marginRight: theme.spacing.sm, }, smallText: { fontSize: 14, color: theme.colors.textSecondary, fontFamily: theme.typography.fontFamily.regular, }, }); export default LoadingState; /* * End of File: LoadingState.tsx * Design & Developed by Tech4Biz Solutions * Copyright (c) Spurrin Innovations. All rights reserved. */