import { useState } from 'react'; import { View, Text, StyleSheet, Pressable, TouchableWithoutFeedback, Keyboard } from 'react-native'; import Verification from './formPages/verification'; import BasicInformation from './formPages/basicInformation'; import CarInformation from './formPages/carInformation'; import PaginationIndicator from '../../global/PaginationIndicator'; import CreateWallet from './formPages/createWallet'; import FinishSignUp from './formPages/finishSignUp'; import LoginPage from './formPages/loginPage'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; import ChooseCarBrand from './formPages/chooseCarPage/carBrand'; import ChooseCarSeries from './formPages/chooseCarPage/carSeries'; import ChooseCarModel from './formPages/chooseCarPage/carModel'; import ForgetPasswordForm from '../../forgetPasswordMultiStepForm/forgetPasswordForm'; import SetVehiclesOne from '../../../app/(auth)/(tabs)/(home)/(vehicle)/setVehiclesOne'; import SetVehiclesTwo from '../../../app/(auth)/(tabs)/(home)/(vehicle)/setVehiclesTwo'; import BindingMultiStepForm from '../../bindingMultiStepForm/bindingMultiStepForm'; type FormProps = {}; const Form: React.FC = ({}) => { const [screen, setScreen] = useState(0); const FormTitle = ['', '註冊 - 電話驗證', '註冊 - 基本資料', '註冊 - 基本資料', '註冊 - 設立銀包']; const ScreenDisplay = () => { switch (screen) { case 0: return ( ); case 1: return ; case 2: return ; // case 3: // return ; // case 3: // return ; case 3: return ; case 4: return ; case 6: return ( ); case 7: return ( ); case 8: return ( ); case 9: return ; case 11: return ; default: return <>; } }; const goToPreviousPage = () => { setScreen((prevState) => { if (prevState > 0) { return prevState - 1; } else { return prevState; } }); }; const goToNextPage = () => { setScreen((prevState) => { if (prevState < 6) { return prevState + 1; } else { return prevState; } }); }; const goToChooseCarBrandPage = () => { setScreen((prevState) => { return 6; }); }; const goToChooseCarSeriesPage = () => { setScreen((prevState) => { return 7; }); }; const goToChooseCarModelPage = () => { setScreen((prevState) => { return 8; }); }; const goToCarInformation = () => { setScreen((prevState) => { return 4; }); }; const goToForgetPassWordPage = () => { setScreen((prevState) => { return 9; }); }; const goToBindingPhoneNumberPage = () => { setScreen((prevState) => { return 11; }); }; return ( <> {/* not showing title and pagination on the first and last page */} {screen == 0 || (screen < 4 && ( //dismiss keyboard when user click outside of the input field to improve user experience Keyboard.dismiss()}> {FormTitle[screen]} {`< 上一步`} {`下一步 >`} ))} {ScreenDisplay()} ); }; const styles = StyleSheet.create({ topContainer: { flex: 1, alignItems: 'center', justifyContent: 'center', paddingBottom: '20%', paddingTop: '15%' }, previouspageAndPaginationWrapper: { display: 'flex', width: '100%', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingHorizontal: 25 }, bottomContainer: { flex: 2.5 }, breakline: { width: 24, height: 1, backgroundColor: '#000000', marginVertical: 17 }, text: { fontSize: 24, fontWeight: '300' } }); export default Form;