addVehiclePageComponent.tsx 4.8 KB

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