| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import React from 'react';
- import { View, Text, StyleSheet, Pressable, FlatList } from 'react-native';
- import { FlashList } from '@shopify/flash-list';
- import useSignUpStore from '../../../../../providers/signup_form_store';
- type ChooseCarModelProps = {
- goToChooseCarSeriesPage: () => void;
- goToCarInformation: () => void;
- };
- //hard-coded mock data
- const fakeData = [
- { name: 'vehicle 1' },
- { name: 'vehicle 2' },
- { name: 'vehicle 3' },
- { name: 'vehicle 4' }
- ];
- const ChooseCarModel: React.FC<ChooseCarModelProps> = ({
- goToChooseCarSeriesPage,
- goToCarInformation
- }) => {
- const { signUpFormData, setSignUpFormData } = useSignUpStore();
- const handleSelectModel = (model: string) => {
- setSignUpFormData({
- ...signUpFormData,
- selectedCarModel: model
- });
- goToCarInformation();
- };
- return (
- <View style={styles.mainContainer}>
- <View style={styles.titleContainer}>
- <Text style={{ fontSize: 24, fontWeight: '300' }}>
- 選擇車系
- </Text>
- </View>
- <View style={styles.paginationContainer}>
- <Pressable onPress={goToChooseCarSeriesPage}>
- <Text style={{ color: '#888888' }}>{`< 上一步`}</Text>
- </Pressable>
- </View>
- <View style={styles.bottomContainer}>
- <FlashList
- data={fakeData}
- estimatedItemSize={20}
- renderItem={({ item }) => (
- <Pressable onPress={() => handleSelectModel(item.name)}>
- <View style={styles.listContainer}>
- <View style={styles.logoContainer}>
- <Text
- style={{
- fontSize: 24,
- fontWeight: '200'
- }}
- >
- {'logo'}
- </Text>
- </View>
- <View style={styles.itemContainer}>
- <Text style={styles.item}>{item.name}</Text>
- </View>
- </View>
- </Pressable>
- )}
- />
- </View>
- </View>
- );
- };
- const styles = StyleSheet.create({
- mainContainer: {
- flex: 1,
- flexDirection: 'column',
- backgroundColor: '#FFFFFF'
- },
- titleContainer: {
- flex: 1,
- alignItems: 'center',
- justifyContent: 'center'
- },
- paginationContainer: {
- flex: 0.3,
- paddingLeft: '6%',
- paddingBottom: '5%'
- },
- bottomContainer: {
- flex: 7
- },
- listContainer: {
- flex: 0.5,
- flexDirection: 'row',
- alignItems: 'center',
- paddingVertical: 15
- },
- logoContainer: {
- flex: 2,
- alignItems: 'center'
- },
- itemContainer: {
- flex: 8
- },
- item: {
- paddingLeft: '6%',
- fontSize: 24,
- fontWeight: '200'
- }
- });
- export default ChooseCarModel;
|