/* * File: LoginScreen.tsx * Description: Login screen with a loading indicator on the submit button. * Design & Developed by Tech4Biz Solutions * Copyright (c) Spurrin Innovations. All rights reserved. */ import React, { useState } from 'react'; import { View, Text, StyleSheet, TouchableWithoutFeedback, Keyboard, TouchableOpacity, TextInput, // Using default TextInput for container styling } from 'react-native'; import { Button } from '../../../../shared/src/components/Button'; import { Colors, Spacing, Typography } from '../../../../shared/src/theme'; import { useAppDispatch } from '../../../redux/hooks'; import { login } from '../redux/authActions'; import { showError } from '../../../../shared/src/utils/helpers/Toast'; import { validateEmail } from '../../../../shared/src/utils/validation/validators'; import Icon from 'react-native-vector-icons/Feather'; const LoginScreen: React.FC = () => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [isPasswordVisible, setPasswordVisible] = useState(false); const [loading, setLoading] = useState(false); // Add loading state const dispatch = useAppDispatch(); const handleLogin = () => { if (!email.trim() || !password.trim()) { showError('Validation Error', 'Email and password are required.'); return; } if (!validateEmail(email)) { showError('Validation Error', 'Please enter a valid email address.'); return; } setLoading(true); // Start loading dispatch(login({ email, password })); // Simulate a network request for 4 seconds setTimeout(() => { setLoading(false); // Stop loading after 4 seconds }, 4000); }; return ( Radiologist Portal {/* Email Input */} {/* Password Input */} setPasswordVisible(!isPasswordVisible)} style={styles.eyeIcon}>