import React, {useEffect, useState} from 'react'; import Button from '../component/Button'; import Input from '../component/Input'; import {Picker} from '@react-native-picker/picker'; import {View, StyleSheet, Text, ScrollView, Alert} from 'react-native'; import {HelperText} from 'react-native-paper'; import { container, ItemFlex, ItemFlex2, direction, pageTitleBox, pageTitle, textColor, marginRight, } from '../resoureces/styles/GlobalStyles'; import {url} from '../url'; import {PRIMARY, WHITE} from '../color'; export default function JoinMembers({navigation}) { /* 퉥스트 입력 */ const [userId, setUserId] = useState(''); const [userPassword, setUserPassword] = useState(); const [userPasswordCked, setUserPasswordCked] = useState(); const [name, setName] = useState(); const [year, setYear] = useState(); const [month, setMonth] = useState(); const [day, setDay] = useState(); const [phone, setPhone] = useState(); const [email, setEmail] = useState(); const [selectedLanguage, setSelectedLanguage] = useState(); const [userSex, setUserSex] = useState(); const [idchecked, setIdChecked] = useState(false); const [pwChecked, setPwChecked] = useState(false); const joinFetchData = () => { fetch(`${url}/auth/register`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ id: userId, password: userPassword, email: email, user_sex: userSex, phone: phone, }), }) .then(response => response.json()) .then(data => { console.log(data); if (data.Authorization === userId) { Alert.alert('회원가입이 완료되었습니다.'); navigation.navigate('Login'); } else { Alert.alert('입력 정보를 확인해주세요.'); } }) .catch(err => { console.error(err); }); }; const validation = () => { fetch(`${url}/auth/id`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ id: userId, }), }) .then(data => { if (data.ok) { setIdChecked(true); } else { setIdChecked(false); } }) .catch(err => { console.error(err); }); }; return ( 회원가입 아이디 { setUserId(userId); }} // onBlur={validation()} />