multi_step_form.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Text, View, StyleSheet } from "react-native";
  2. import { StatusBar } from "expo-status-bar";
  3. import Form from "./formComponent/form";
  4. import { useEffect, useState } from "react";
  5. import { SignUpFormData } from "../../types/signup";
  6. import useSignUpStore from "../../providers/signup_form_store";
  7. const MultiStepForm: React.FC = () => {
  8. const [formData, setFormData] = useState<SignUpFormData>({
  9. phone: "",
  10. phoneVerificationStatus: false,
  11. name: "",
  12. password: "",
  13. email: "",
  14. birthDate: "",
  15. isUberDriver: undefined,
  16. vehicleType: "",
  17. vehicleModel: "",
  18. licensePlate: "",
  19. address: "",
  20. paymentMethod: "",
  21. });
  22. //logging to check if parent component can successfully receive user input in the multi-step form
  23. const { signUpFormData } = useSignUpStore();
  24. useEffect(() => {
  25. console.log("Current Zustand Store:", signUpFormData);
  26. }, [signUpFormData]);
  27. return (
  28. <View style={styles.container}>
  29. <Form formData={formData} setFormData={setFormData} />
  30. <StatusBar style="auto" />
  31. </View>
  32. );
  33. };
  34. const styles = StyleSheet.create({
  35. container: {
  36. flex: 1,
  37. backgroundColor: "#FFFFFF",
  38. },
  39. });
  40. export default MultiStepForm;