You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.0 KiB

5 months ago
  1. import React, { useEffect, useState } from "react";
  2. import { Text, View } from "react-native";
  3. import ETextInput from "@components/ETextInput";
  4. import EFullButton from "@components/EButton";
  5. import { ELabelText, ETitleText } from "@components/EText";
  6. import ENavButtons from "@components/ENavButtons";
  7. import { useAuthState } from "@components/AuthProvider";
  8. import { useRouter } from "expo-router";
  9. // implement logic here later.
  10. export default function RegisterEmail(props: any) {
  11. const [email, setEmail] = useState<string>('');
  12. const emailre =
  13. /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;
  14. const [user, loginState, setLoginState] = useAuthState();
  15. useEffect(() => {
  16. setEmail(loginState?.tempEmail || '')
  17. }, [])
  18. const router = useRouter();
  19. return (
  20. <>
  21. <View
  22. style={{
  23. flexDirection: "column",
  24. }}
  25. >
  26. <ENavButtons back={true} />
  27. <View style={{ flexDirection: "column", marginTop: 0 }}>
  28. <ETitleText style={{ marginBottom: 24 }}>
  29. </ETitleText>
  30. <View style={{ rowGap: 8 }}>
  31. <ELabelText></ELabelText>
  32. <ETextInput
  33. placeholder="이메일 입력하기"
  34. value={email}
  35. setValue={setEmail}
  36. onChange={(v) => setLoginState && setLoginState({ ...loginState, tempEmail: v })}
  37. />
  38. </View>
  39. </View>
  40. <EFullButton
  41. style={{ marginTop: 24 }}
  42. text="다음"
  43. active={emailre.test(email)}
  44. onPress={() => router.push('auth/createpassword', )}
  45. />
  46. </View>
  47. </>
  48. );
  49. }