|
@@ -1,4 +1,4 @@
|
|
|
-import { View, Text, StyleSheet } from 'react-native';
|
|
|
|
|
|
|
+import { View, Text, StyleSheet, Pressable, TextInput } from 'react-native';
|
|
|
import NormalInput from '../../../global/normal_input';
|
|
import NormalInput from '../../../global/normal_input';
|
|
|
import NormalButton from '../../../global/normal_button';
|
|
import NormalButton from '../../../global/normal_button';
|
|
|
import { useState } from 'react';
|
|
import { useState } from 'react';
|
|
@@ -6,16 +6,20 @@ import useSignUpStore from '../../../../providers/signup_form_store';
|
|
|
|
|
|
|
|
type CarInformationProps = {
|
|
type CarInformationProps = {
|
|
|
goToNextPage: () => void;
|
|
goToNextPage: () => void;
|
|
|
|
|
+ goToChooseCarPage: () => void;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const CarInformation: React.FC<CarInformationProps> = ({ goToNextPage }) => {
|
|
|
|
|
- const { signUpFormData, setSignUpFormData } = useSignUpStore();
|
|
|
|
|
|
|
+const CarInformation: React.FC<CarInformationProps> = ({
|
|
|
|
|
+ goToNextPage,
|
|
|
|
|
+ goToChooseCarPage
|
|
|
|
|
+}) => {
|
|
|
|
|
+ const { signUpFormData } = useSignUpStore();
|
|
|
const [error, setError] = useState('');
|
|
const [error, setError] = useState('');
|
|
|
const handleNext = () => {
|
|
const handleNext = () => {
|
|
|
if (
|
|
if (
|
|
|
- signUpFormData.vehicleModel === '' ||
|
|
|
|
|
- signUpFormData.vehicleModel === '' ||
|
|
|
|
|
- signUpFormData.licensePlate === ''
|
|
|
|
|
|
|
+ signUpFormData.selectedCarBrand === '' ||
|
|
|
|
|
+ signUpFormData.selectedCarSeries === '' ||
|
|
|
|
|
+ signUpFormData.selectedCarModel === ''
|
|
|
) {
|
|
) {
|
|
|
setError('請確保所有資料都已填寫。');
|
|
setError('請確保所有資料都已填寫。');
|
|
|
} else {
|
|
} else {
|
|
@@ -24,14 +28,14 @@ const CarInformation: React.FC<CarInformationProps> = ({ goToNextPage }) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const vehicleTypeFieldPlaceholder = signUpFormData.vehicleType
|
|
|
|
|
- ? signUpFormData.vehicleType
|
|
|
|
|
|
|
+ const vehicleTypeFieldPlaceholder = signUpFormData.selectedCarBrand
|
|
|
|
|
+ ? signUpFormData.selectedCarBrand
|
|
|
: '車輛品牌';
|
|
: '車輛品牌';
|
|
|
- const vehicleModelFieldPlaceholder = signUpFormData.vehicleModel
|
|
|
|
|
- ? signUpFormData.vehicleModel
|
|
|
|
|
|
|
+ const vehicleModelFieldPlaceholder = signUpFormData.selectedCarSeries
|
|
|
|
|
+ ? signUpFormData.selectedCarSeries
|
|
|
: '車輛型號';
|
|
: '車輛型號';
|
|
|
- const licensePlateFieldPlaceholder = signUpFormData.licensePlate
|
|
|
|
|
- ? signUpFormData.licensePlate
|
|
|
|
|
|
|
+ const licensePlateFieldPlaceholder = signUpFormData.selectedCarModel
|
|
|
|
|
+ ? signUpFormData.selectedCarModel
|
|
|
: '車輛號碼';
|
|
: '車輛號碼';
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -45,36 +49,29 @@ const CarInformation: React.FC<CarInformationProps> = ({ goToNextPage }) => {
|
|
|
gap: 10
|
|
gap: 10
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
- <NormalInput
|
|
|
|
|
- value={signUpFormData.vehicleType}
|
|
|
|
|
- placeholder={vehicleTypeFieldPlaceholder}
|
|
|
|
|
- onChangeText={(vehicleType) => {
|
|
|
|
|
- setSignUpFormData({
|
|
|
|
|
- ...signUpFormData,
|
|
|
|
|
- vehicleType: vehicleType
|
|
|
|
|
- });
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- <NormalInput
|
|
|
|
|
- value={signUpFormData.vehicleModel}
|
|
|
|
|
- placeholder={vehicleModelFieldPlaceholder}
|
|
|
|
|
- onChangeText={(vehicleModel) => {
|
|
|
|
|
- setSignUpFormData({
|
|
|
|
|
- ...signUpFormData,
|
|
|
|
|
- vehicleModel: vehicleModel
|
|
|
|
|
- });
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- <NormalInput
|
|
|
|
|
- value={signUpFormData.licensePlate}
|
|
|
|
|
- placeholder={licensePlateFieldPlaceholder}
|
|
|
|
|
- onChangeText={(licensePlate) => {
|
|
|
|
|
- setSignUpFormData({
|
|
|
|
|
- ...signUpFormData,
|
|
|
|
|
- licensePlate: licensePlate
|
|
|
|
|
- });
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <Pressable
|
|
|
|
|
+ style={styles.button}
|
|
|
|
|
+ onPress={goToChooseCarPage}
|
|
|
|
|
+ >
|
|
|
|
|
+ <TextInput
|
|
|
|
|
+ style={styles.fakeTextInput}
|
|
|
|
|
+ placeholder={vehicleTypeFieldPlaceholder}
|
|
|
|
|
+ editable={false}
|
|
|
|
|
+ pointerEvents="none"
|
|
|
|
|
+ ></TextInput>
|
|
|
|
|
+ <TextInput
|
|
|
|
|
+ style={styles.fakeTextInput}
|
|
|
|
|
+ placeholder={vehicleModelFieldPlaceholder}
|
|
|
|
|
+ editable={false}
|
|
|
|
|
+ pointerEvents="none"
|
|
|
|
|
+ ></TextInput>
|
|
|
|
|
+ <TextInput
|
|
|
|
|
+ style={styles.fakeTextInput}
|
|
|
|
|
+ placeholder={licensePlateFieldPlaceholder}
|
|
|
|
|
+ editable={false}
|
|
|
|
|
+ pointerEvents="none"
|
|
|
|
|
+ ></TextInput>
|
|
|
|
|
+ </Pressable>
|
|
|
<NormalButton
|
|
<NormalButton
|
|
|
title={<Text style={{ color: '#fff' }}>下一步</Text>}
|
|
title={<Text style={{ color: '#fff' }}>下一步</Text>}
|
|
|
onPress={handleNext}
|
|
onPress={handleNext}
|
|
@@ -97,6 +94,15 @@ const styles = StyleSheet.create({
|
|
|
flex: 1,
|
|
flex: 1,
|
|
|
marginHorizontal: 20
|
|
marginHorizontal: 20
|
|
|
},
|
|
},
|
|
|
|
|
+ button: { flex: 1, gap: 10, marginTop: 5 },
|
|
|
|
|
+ fakeTextInput: {
|
|
|
|
|
+ maxWidth: '100%',
|
|
|
|
|
+ fontSize: 16,
|
|
|
|
|
+ borderWidth: 1,
|
|
|
|
|
+ padding: 20,
|
|
|
|
|
+ borderRadius: 12,
|
|
|
|
|
+ borderColor: '#bbbbbb'
|
|
|
|
|
+ },
|
|
|
text: {
|
|
text: {
|
|
|
fontSize: 20,
|
|
fontSize: 20,
|
|
|
paddingBottom: 10
|
|
paddingBottom: 10
|