homePage.tsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import { View, Text, ScrollView, FlatList } from 'react-native';
  2. import NormalButton from '../global/normal_button';
  3. import NormalInput from '../global/normal_input';
  4. import { SafeAreaView } from 'react-native-safe-area-context';
  5. import { router } from 'expo-router';
  6. import RecentlyBookedScrollView from '../global/recentlyBookedScrollView';
  7. import { BellIconSvg, HomeIconSvg } from '../global/SVG';
  8. import { AuthContext } from '../../context/AuthProvider';
  9. import { useContext, useEffect } from 'react';
  10. interface HomePageProps {}
  11. const HomePage: React.FC<HomePageProps> = () => {
  12. const { user } = useContext(AuthContext);
  13. return (
  14. <SafeAreaView
  15. edges={['top', 'left', 'right']}
  16. className="flex-1 bg-white"
  17. >
  18. <ScrollView
  19. showsVerticalScrollIndicator={false}
  20. className="flex-1 mx-[5%] mt-8 "
  21. >
  22. <View className="">
  23. <View className="flex-row items-center pb-4">
  24. <HomeIconSvg />
  25. <View className="pl-2 flex-1 flex-column ">
  26. <View className="flex-row justify-between">
  27. <Text className="text-lg pb-1">你好!</Text>
  28. <BellIconSvg />
  29. </View>
  30. <Text className="text-4xl font-light ">
  31. {user?.nickname}
  32. </Text>
  33. </View>
  34. </View>
  35. <NormalInput
  36. placeholder="搜尋充電站或地區"
  37. onChangeText={() => console.log('abc')}
  38. />
  39. </View>
  40. {/* ************************近期預約過************************ */}
  41. <RecentlyBookedScrollView />
  42. {/* ************************Bottom Button Groups************************ */}
  43. <View className="">
  44. <View className=" mb-4">
  45. <NormalButton
  46. onPress={() => console.log('掃瞄及充電')}
  47. title={
  48. <Text className="text-white font-bold text-lg">
  49. 掃瞄及充電
  50. </Text>
  51. }
  52. extendedStyle={{
  53. alignItems: 'flex-start',
  54. padding: 24
  55. }}
  56. />
  57. </View>
  58. <View className="flex-1 flex-row justify-between gap-6">
  59. <View className="flex-1">
  60. <NormalButton
  61. onPress={() =>
  62. router.push('bookingMenuPage')
  63. }
  64. title={
  65. <Text className="text-white font-bold text-lg">
  66. 我的預約
  67. </Text>
  68. }
  69. extendedStyle={{
  70. alignItems: 'flex-start',
  71. padding: 24
  72. }}
  73. />
  74. </View>
  75. <View className="flex-1">
  76. <NormalButton
  77. onPress={() => router.push('myVehiclePage')}
  78. title={
  79. <Text className="text-white font-bold text-lg">
  80. 我的車輛
  81. </Text>
  82. }
  83. extendedStyle={{
  84. alignItems: 'flex-start',
  85. padding: 24
  86. }}
  87. />
  88. </View>
  89. </View>
  90. </View>
  91. </ScrollView>
  92. </SafeAreaView>
  93. );
  94. };
  95. export default HomePage;