import { StyleSheet, Text, View, SafeAreaView, KeyboardAvoidingView, Image, TextInput, Pressable, Alert } from 'react-native' import React, { useState } from 'react' import { Fontisto } from '@expo/vector-icons'; import { Entypo } from '@expo/vector-icons'; import { AntDesign } from '@expo/vector-icons'; import { useRouter } from 'expo-router'; import axios from "axios"; const register = () => { const [name, setName] = useState(''); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const router = useRouter(); const handleRegister = () => { const user = { name: name, email: email, password: password, } axios.post("http://localhost:3030/register", user).then((res) => { console.log(res); Alert.alert("Registration succeeded!"); setEmail(''); setPassword(''); setName(''); }).catch((error) => { Alert.alert("Registration failed!"); console.log("error", error); }) } return ( Keep Tracking Register setName(text)} style={{color: "#31363F", width:250, outlineStyle: 'none', marginVertical: 10, fontSize:email ? 14 : 14}} placeholder='Username'/> setEmail(text)} style={{color: "#31363F", width:250, outlineStyle: 'none', marginVertical: 10, fontSize:email ? 14 : 14}} placeholder='Enter your email'/> setPassword(text)} secureTextEntry={true} style={{color: "#31363F", width:250, outlineStyle: 'none', marginVertical: 10, fontSize:email ? 14 : 14}} placeholder='Enter your password'/> Register router.replace("/login")} style={{marginTop: 10}}> Already have an account? Login ) } export default register const styles = StyleSheet.create({})