|
|
@@ -4,6 +4,7 @@ import { useState } from "react";
|
|
|
import DateModal from "../../../global/date_input";
|
|
|
import NormalButton from "../../../global/normal_button";
|
|
|
import { SignUpFormData, HandleSignUpFormDataChange } from "../../../../types/signup";
|
|
|
+import useSignUpStore from "../../../../providers/signup_form_store";
|
|
|
|
|
|
type basicInformationProps = {
|
|
|
goToNextPage: () => void;
|
|
|
@@ -12,9 +13,10 @@ type basicInformationProps = {
|
|
|
};
|
|
|
|
|
|
const BasicInformation: React.FC<basicInformationProps> = ({ handleFormDataChange, goToNextPage, formData }) => {
|
|
|
+ const { signUpFormData, setSignUpFormData } = useSignUpStore();
|
|
|
const [error, setError] = useState("");
|
|
|
const handleNext = () => {
|
|
|
- if (formData.name === "" || formData.password === "" || formData.birthDate === "") {
|
|
|
+ if (signUpFormData.name === "" || signUpFormData.password === "" || signUpFormData.birthDate === "") {
|
|
|
setError("請確保所有資料都已填寫。");
|
|
|
} else {
|
|
|
setError("");
|
|
|
@@ -33,12 +35,28 @@ const BasicInformation: React.FC<basicInformationProps> = ({ handleFormDataChang
|
|
|
gap: 10,
|
|
|
}}
|
|
|
>
|
|
|
- <NormalInput placeholder="姓名" onChangeText={(text) => handleFormDataChange("name", text)} />
|
|
|
+ {/* <NormalInput placeholder="姓名" onChangeText={(text) => handleFormDataChange("name", text)} /> */}
|
|
|
<NormalInput
|
|
|
+ placeholder="姓名"
|
|
|
+ onChangeText={(text) => {
|
|
|
+ setSignUpFormData({ ...signUpFormData, name: text });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+
|
|
|
+ {/* <NormalInput
|
|
|
placeholder="帳戶密碼"
|
|
|
onChangeText={(text) => handleFormDataChange("password", text)}
|
|
|
secureTextEntry={true}
|
|
|
+ /> */}
|
|
|
+
|
|
|
+ <NormalInput
|
|
|
+ placeholder="帳戶密碼"
|
|
|
+ onChangeText={(text) => {
|
|
|
+ setSignUpFormData({ ...signUpFormData, password: text });
|
|
|
+ }}
|
|
|
+ secureTextEntry={true}
|
|
|
/>
|
|
|
+
|
|
|
<View style={{ display: "flex", flexDirection: "row", gap: 10 }}>
|
|
|
{/* await YoYo's code review for gender */}
|
|
|
<NormalInput
|
|
|
@@ -46,11 +64,17 @@ const BasicInformation: React.FC<basicInformationProps> = ({ handleFormDataChang
|
|
|
onChangeText={(t) => console.log(t)}
|
|
|
extendedStyle={{ width: "50%" }}
|
|
|
/>
|
|
|
- <DateModal
|
|
|
+ {/* <DateModal
|
|
|
placeholder={formData.birthDate ? formData.birthDate : "DD/MM/YY"}
|
|
|
onDateChange={(date) => {
|
|
|
handleFormDataChange("birthDate", date);
|
|
|
}}
|
|
|
+ /> */}
|
|
|
+ <DateModal
|
|
|
+ placeholder={signUpFormData.birthDate ? signUpFormData.birthDate : "DD/MM/YY"}
|
|
|
+ onDateChange={(date) => {
|
|
|
+ setSignUpFormData({ ...signUpFormData, birthDate: date });
|
|
|
+ }}
|
|
|
/>
|
|
|
</View>
|
|
|
<NormalButton
|