multi_step_form.tsx 1.3 KB

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