manageVehiclePageComponent.tsx 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import { router } from 'expo-router';
  2. import {
  3. View,
  4. Text,
  5. ScrollView,
  6. Pressable,
  7. Image,
  8. Dimensions,
  9. StyleSheet
  10. } from 'react-native';
  11. import { SafeAreaView } from 'react-native-safe-area-context';
  12. import { PreviousPageBlackSvg, StarSvg } from '../global/SVG';
  13. import NormalButton from '../global/normal_button';
  14. import { useState } from 'react';
  15. const ManageVehiclePageComponent = () => {
  16. const { height: deviceHeight, width: deviceWidth } =
  17. Dimensions.get('window');
  18. return (
  19. <SafeAreaView
  20. className="flex-1 bg-white"
  21. edges={['top', 'right', 'left']}
  22. >
  23. <ScrollView
  24. showsVerticalScrollIndicator={false}
  25. className="flex-1 mx-[5%]"
  26. >
  27. <View style={{ marginTop: 25, flexDirection: 'column' }}>
  28. <Pressable
  29. className="self-start"
  30. onPress={() => {
  31. if (router.canGoBack()) {
  32. router.back();
  33. } else {
  34. router.replace('/accountMainPage');
  35. }
  36. }}
  37. >
  38. <PreviousPageBlackSvg />
  39. </Pressable>
  40. </View>
  41. <Text
  42. style={{
  43. fontSize: 30,
  44. marginTop: 25,
  45. marginBottom: 10
  46. }}
  47. >
  48. 管理車輛
  49. </Text>
  50. <View className="items-center ">
  51. <Image
  52. source={require('../../assets/car.png')}
  53. resizeMode="contain"
  54. style={{
  55. width: deviceWidth * 0.8,
  56. height: deviceHeight * 0.25
  57. }}
  58. />
  59. </View>
  60. <View className="flex-row space-x-2 ">
  61. <View
  62. style={{
  63. width: 4,
  64. height: '100%',
  65. backgroundColor: '#02677D'
  66. }}
  67. />
  68. <View>
  69. <Text className="text-2xl">TESLA Model 3</Text>
  70. <Text className="text-lg text-[#888888]">CE1107</Text>
  71. </View>
  72. </View>
  73. <NormalButton
  74. title={
  75. <Text
  76. style={{
  77. fontWeight: '500',
  78. fontSize: 20,
  79. color: '#fff'
  80. }}
  81. >
  82. 設置為預設車輛 <StarSvg />
  83. </Text>
  84. }
  85. // onPress={() => router.push(addVehicleSuccessful)}
  86. onPress={() => console.log('ab')}
  87. extendedStyle={{ marginTop: 24 }}
  88. />
  89. <View className="w-full h-1 my-4 bg-[#DBE4E8]" />
  90. <View>
  91. <Text className="text-xl pb-4">車輛資訊</Text>
  92. <Text className="text-base text-[#888888]">加入日期</Text>
  93. <Text className="text-base mb-3">2/24/2024</Text>
  94. <Text className="text-base text-[#888888]">總充電量</Text>
  95. <Text className="text-base mb-3">307kWh</Text>
  96. <Text className="text-base text-[#888888]">上一次充電</Text>
  97. <Text className="text-base mb-3">3/12/2024</Text>
  98. <View className="my-4 pb-8">
  99. <NormalButton
  100. title={
  101. <Text
  102. style={{
  103. color: 'white',
  104. fontSize: 20,
  105. fontWeight: '800'
  106. }}
  107. >
  108. 删除車輛
  109. </Text>
  110. }
  111. onPress={() => router.replace('mainPage')}
  112. extendedStyle={{
  113. backgroundColor: '#D40000'
  114. }}
  115. />
  116. </View>
  117. </View>
  118. </ScrollView>
  119. </SafeAreaView>
  120. );
  121. };
  122. const styles = StyleSheet.create({
  123. button: { flex: 1, gap: 10, marginTop: 5 },
  124. fakeTextInput: {
  125. maxWidth: '100%',
  126. fontSize: 16,
  127. borderWidth: 1,
  128. padding: 20,
  129. borderRadius: 12,
  130. borderColor: '#bbbbbb'
  131. },
  132. checkbox: {
  133. margin: 8
  134. }
  135. });
  136. export default ManageVehiclePageComponent;