import { StyleSheet, ScrollView, View, Text, TextInput, TouchableOpacity, } from 'react-native'; import React from 'react'; import {useNavigation} from '@react-navigation/native'; import {NativeStackNavigationProp} from '@react-navigation/native-stack'; import {useLoginAPI} from '../utils/loginUtils'; import {RootStackParam} from '../utils/RootStackParam'; import {useFocusEffect} from '@react-navigation/native'; export default function LoginScreen() { const navigation = useNavigation>(); const {loginAPI} = useLoginAPI(navigation); const [loginData, setLogin] = React.useState({ id: '', password: '', }); const handleInputChange = (field: string, value: string | number | null) => { setLogin(prevLogin => ({ ...prevLogin, [field]: value, })); }; useFocusEffect( React.useCallback(() => { setLogin({ id: '', password: '', }); }, []), ); // 로그인 const handleSubmit = async () => { console.log(loginData); // try { const response = await loginAPI(loginData); console.log('Response from server:', response); } catch (error) { console.error('Error submitting agreement:', error); } }; return ( 로그인 아이디 handleInputChange('id', text)} /> 비밀번호 handleInputChange('password', text)} /> 로그인 navigation.navigate('AgreementScreen')}> 회원가입 하러 가기 ); } const styles = StyleSheet.create({ container: { flex: 1, paddingHorizontal: 16, paddingVertical: 50, justifyContent: 'center', backgroundColor: '#ffffff', }, logoPoint: { fontSize: 25, color: '#3872ef', fontWeight: 'bold', textAlign: 'center', marginTop: 20, marginBottom: 30, }, inputText: { color: '#959595', marginVertical: 10, }, input: { borderColor: '#959595', borderRadius: 10, borderWidth: 1, marginBottom: 10, padding: 10, backgroundColor: '#ffffff', }, button: { backgroundColor: '#3872ef', padding: 10, borderRadius: 10, marginTop: 30, marginBottom: 10, }, buttonText: { color: '#ffffff', textAlign: 'center', }, toAgreement: { marginTop: 30, alignItems: 'center', color: '#ccc', }, });