import React, { useState } from 'react'; import { View, Text, TouchableOpacity, SafeAreaView, Alert } from 'react-native'; import { InputField, CheckBox, Button, InlineButton } from '@components'; import { styles } from './login.styles'; import authService from '../../services/authService'; interface LoginScreenProps { onLoginSuccess: (token: string) => void; onCreateAccount?: () => void; onForgotPassword?: () => void; } export function LoginScreen({ onLoginSuccess, onCreateAccount, onForgotPassword, }: LoginScreenProps) { const [emailOrPhone, setEmailOrPhone] = useState(''); const [password, setPassword] = useState(''); const [secureTextEntry, setSecureTextEntry] = useState(true); const [rememberMe, setRememberMe] = useState(false); const [loading, setLoading] = useState(false); const handleSignIn = async () => { if (!emailOrPhone.trim() || !password.trim()) { Alert.alert('Error', 'Please enter both email/phone number and password'); return; } setLoading(true); try { const token = await authService.signIn(emailOrPhone, password); onLoginSuccess(token); } catch (error: any) { Alert.alert('Login Failed', error.message || 'Something went wrong'); } finally { setLoading(false); } }; const toggleSecureEntry = () => { setSecureTextEntry(prev => !prev); }; return ( {/* Header */} Welcome Back Please enter your credentials to access your account. {/* Email or Phone Input */} {/* Password Input */} ( {secureTextEntry ? '👁️' : '🙈'} )} /> {/* Remember Me & Forgot Password */} {})} highlightedText="Forgot password?" highlightedTextStyle={styles.forgotPasswordText} /> {/* Sign In Button */}