testingCar2.tsx 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. // interface CarModel {
  2. // name: string;
  3. // year: number;
  4. // }
  5. // interface CarModelSection {
  6. // category: string;
  7. // models: CarModel[];
  8. // }
  9. // const carModels: CarModelSection[] = [
  10. // {
  11. // category: 'SUV',
  12. // models: [
  13. // { name: 'X1', year: 2023 },
  14. // { name: 'X3', year: 2023 },
  15. // { name: 'X5', year: 2023 }
  16. // ]
  17. // },
  18. // {
  19. // category: 'Sedan',
  20. // models: [
  21. // { name: '3 Series', year: 2023 },
  22. // { name: '5 Series', year: 2023 },
  23. // { name: '7 Series', year: 2023 }
  24. // ]
  25. // },
  26. // {
  27. // category: 'Electric',
  28. // models: [
  29. // { name: 'i3', year: 2023 },
  30. // { name: 'i4', year: 2023 },
  31. // { name: 'iX', year: 2023 }
  32. // ]
  33. // }
  34. // ];
  35. // import React, { useEffect } from 'react';
  36. // import { View, Text, Image, Pressable, StyleSheet, ScrollView } from 'react-native';
  37. // import useVehicleStore from '../../providers/vehicle_store';
  38. // import { FlashList } from '@shopify/flash-list';
  39. // import { router } from 'expo-router';
  40. // import { PreviousPageBlackSvg } from './SVG';
  41. // import { SafeAreaView } from 'react-native-safe-area-context';
  42. // const CarModelSelector = ({ brandName }: { brandName: string }) => {
  43. // const renderModelItem = ({ item: model }: { item: CarModel }) => (
  44. // <Pressable style={styles.modelItem} onPress={() => console.log(model.name)}>
  45. // <Text style={styles.modelName}>{model.name}</Text>
  46. // <Text style={styles.modelYear}>{model.year}</Text>
  47. // </Pressable>
  48. // );
  49. // const renderCategorySection = ({ item: section }: { item: CarModelSection }) => (
  50. // <View>
  51. // <View style={styles.categoryHeader}>
  52. // <Text style={styles.categoryText}>{section.category}</Text>
  53. // </View>
  54. // <FlashList
  55. // data={section.models}
  56. // renderItem={renderModelItem}
  57. // keyExtractor={(item) => item.name}
  58. // horizontal={true}
  59. // showsHorizontalScrollIndicator={false}
  60. // />
  61. // </View>
  62. // );
  63. // return (
  64. // <SafeAreaView className="flex-1 bg-white" edges={['top', 'right', 'left']}>
  65. // <ScrollView showsVerticalScrollIndicator={false} className="flex-1 mx-[5%]">
  66. // <View style={{ marginTop: 25 }}>
  67. // <Pressable
  68. // className="self-start"
  69. // onPress={() => {
  70. // if (router.canGoBack()) {
  71. // router.back();
  72. // } else {
  73. // router.replace('/accountMainPage');
  74. // }
  75. // }}
  76. // >
  77. // <PreviousPageBlackSvg />
  78. // </Pressable>
  79. // <Text
  80. // style={{
  81. // fontSize: 30,
  82. // marginTop: 25,
  83. // marginBottom: 10
  84. // }}
  85. // >
  86. // 選擇車輛型號
  87. // </Text>
  88. // </View>
  89. // <View className="flex-1">
  90. // <FlashList
  91. // data={carModels}
  92. // renderItem={renderCategorySection}
  93. // keyExtractor={(item) => item.category}
  94. // />
  95. // </View>
  96. // </ScrollView>
  97. // </SafeAreaView>
  98. // );
  99. // };
  100. // const styles = StyleSheet.create({
  101. // container: {
  102. // flex: 1,
  103. // padding: 10
  104. // },
  105. // brandTitle: {
  106. // fontSize: 24,
  107. // fontWeight: 'bold',
  108. // marginBottom: 20
  109. // },
  110. // categoryHeader: {
  111. // backgroundColor: '#E3F2F8',
  112. // padding: 10,
  113. // marginVertical: 10
  114. // },
  115. // categoryText: {
  116. // color: '#02677D',
  117. // fontSize: 18,
  118. // fontWeight: 'bold'
  119. // },
  120. // modelItem: {
  121. // width: 150,
  122. // height: 100,
  123. // justifyContent: 'center',
  124. // alignItems: 'center',
  125. // backgroundColor: '#F0F0F0',
  126. // margin: 5,
  127. // borderRadius: 10
  128. // },
  129. // modelName: {
  130. // fontSize: 16,
  131. // fontWeight: 'bold'
  132. // },
  133. // modelYear: {
  134. // fontSize: 14,
  135. // color: '#666'
  136. // }
  137. // });
  138. // export default CarModelSelector;