addVehiclePageComponent.tsx 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import { router } from 'expo-router';
  2. import {
  3. View,
  4. Text,
  5. ScrollView,
  6. Pressable,
  7. Image,
  8. Dimensions,
  9. ImageBackground,
  10. StyleSheet,
  11. TextInput
  12. } from 'react-native';
  13. import { SafeAreaView } from 'react-native-safe-area-context';
  14. import { PreviousPageBlackSvg } from '../global/SVG';
  15. import NormalButton from '../global/normal_button';
  16. import { useState } from 'react';
  17. import Checkbox from 'expo-checkbox';
  18. const AddVehiclePageComponent = () => {
  19. const [isChecked, setChecked] = useState(false);
  20. const { height: deviceHeight, width: deviceWidth } =
  21. Dimensions.get('window');
  22. return (
  23. <SafeAreaView
  24. className="flex-1 bg-white"
  25. edges={['top', 'right', 'left']}
  26. >
  27. <ScrollView
  28. showsVerticalScrollIndicator={false}
  29. className="flex-1 mx-[5%]"
  30. >
  31. <View style={{ marginTop: 25 }}>
  32. <Pressable
  33. className="self-start"
  34. onPress={() => {
  35. if (router.canGoBack()) {
  36. router.back();
  37. } else {
  38. router.replace('/accountMainPage');
  39. }
  40. }}
  41. >
  42. <PreviousPageBlackSvg />
  43. </Pressable>
  44. <Text
  45. style={{
  46. fontSize: 30,
  47. marginTop: 25,
  48. marginBottom: 10
  49. }}
  50. >
  51. 新增車輛
  52. </Text>
  53. </View>
  54. <View className="items-center ">
  55. <Image
  56. source={require('../../assets/car.png')}
  57. resizeMode="contain"
  58. style={{
  59. width: deviceWidth * 0.8,
  60. height: deviceHeight * 0.25
  61. }}
  62. />
  63. </View>
  64. <Text className="text-xl mb-4">新增車輛</Text>
  65. <View
  66. style={{
  67. display: 'flex',
  68. flexDirection: 'column',
  69. gap: 10
  70. }}
  71. >
  72. <Pressable
  73. style={styles.button}
  74. onPress={() => console.log('goToChooseCarPage')}
  75. >
  76. <TextInput
  77. style={styles.fakeTextInput}
  78. placeholder="車輛類型"
  79. editable={false}
  80. pointerEvents="none"
  81. ></TextInput>
  82. <TextInput
  83. style={styles.fakeTextInput}
  84. placeholder="車輛型號"
  85. editable={false}
  86. pointerEvents="none"
  87. ></TextInput>
  88. <TextInput
  89. style={styles.fakeTextInput}
  90. placeholder="車輛牌照號碼"
  91. editable={false}
  92. pointerEvents="none"
  93. ></TextInput>
  94. </Pressable>
  95. </View>
  96. <View className="flex-row items-center">
  97. <Text className="mt-4 mb-4 text-lg">設置為預設車輛</Text>
  98. <Checkbox
  99. style={styles.checkbox}
  100. value={isChecked}
  101. onValueChange={setChecked}
  102. color={isChecked ? '#025c72' : undefined}
  103. />
  104. </View>
  105. <NormalButton
  106. title={
  107. <Text
  108. style={{
  109. fontWeight: '700',
  110. fontSize: 20,
  111. color: '#fff'
  112. }}
  113. >
  114. 新增
  115. </Text>
  116. }
  117. onPress={() => router.push('addVehicleSuccessfulPage')}
  118. />
  119. <Text> </Text>
  120. </ScrollView>
  121. </SafeAreaView>
  122. );
  123. };
  124. const styles = StyleSheet.create({
  125. button: { flex: 1, gap: 10, marginTop: 5 },
  126. fakeTextInput: {
  127. maxWidth: '100%',
  128. fontSize: 16,
  129. borderWidth: 1,
  130. padding: 20,
  131. borderRadius: 12,
  132. borderColor: '#bbbbbb'
  133. },
  134. checkbox: {
  135. margin: 8
  136. }
  137. });
  138. export default AddVehiclePageComponent;