addVehiclePageComponent.tsx 4.7 KB

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