notificationPage.tsx 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import {
  2. View,
  3. Text,
  4. Pressable,
  5. Image,
  6. ScrollView,
  7. Alert,
  8. ImageBackground,
  9. ActivityIndicator,
  10. Dimensions
  11. } from 'react-native';
  12. import { SafeAreaView } from 'react-native-safe-area-context';
  13. import { router, useLocalSearchParams } from 'expo-router';
  14. import { CrossLogoSvg, PreviousPageBlackSvg } from '../../../../component/global/SVG';
  15. import { useEffect, useState } from 'react';
  16. import { FlashList } from '@shopify/flash-list';
  17. import DisplayedOnlyCouponTabView from '../../../../component/global/displayedOnlyCouponTabView';
  18. import NotificationTabView from '../../../../component/global/notificationTabViewComponent';
  19. // interface TransactionRecordItem {
  20. // date: string;
  21. // title: string;
  22. // description: string;
  23. // }
  24. // const TransactionRow: React.FC<TransactionRecordItem> = ({ date, description, amount, actual_total_power }) => (
  25. // <View className="flex flex-row w-full py-4 border-b border-[#CCCCCC]">
  26. // <Text className="flex-[0.25] text-sm">{date}</Text>
  27. // <Text className="flex-[0.25] text-sm">{description}</Text>
  28. // <Text className="flex-[0.25] text-sm text-right">
  29. // {actual_total_power !== '-' ? Number(actual_total_power).toFixed(1) : actual_total_power}
  30. // </Text>
  31. // <Text className="flex-[0.25] text-sm text-right">${Number.isInteger(amount) ? amount : amount.toFixed(1)}</Text>
  32. // </View>
  33. // );
  34. const NotificationPageComponent = () => {
  35. const params = useLocalSearchParams();
  36. const screenHeight = Dimensions.get('window').height;
  37. const [loading, setLoading] = useState(false);
  38. const [loading1, setLoading1] = useState(false);
  39. const { reservationAfter2025, passingThisPromotionToBell } = useLocalSearchParams();
  40. const parsedReservationAfter2025 = JSON.parse(reservationAfter2025 as string);
  41. const parsedPassingThisPromotionToBell = JSON.parse(passingThisPromotionToBell as string);
  42. return (
  43. <SafeAreaView className="flex-1 bg-white" edges={['top', 'right', 'left']}>
  44. <View style={{ minHeight: screenHeight, flex: 1 }} className="mx-[5%]">
  45. <View style={{ marginTop: 25 }}>
  46. <Pressable
  47. onPress={() => {
  48. if (router.canGoBack()) {
  49. router.back();
  50. } else {
  51. router.replace('/optionPage');
  52. }
  53. }}
  54. hitSlop={{ top: 20, bottom: 20, left: 20, right: 20 }}
  55. >
  56. <CrossLogoSvg />
  57. </Pressable>
  58. <Text style={{ fontSize: 45, marginVertical: 25 }}>通知</Text>
  59. </View>
  60. <View className="flex-1">
  61. <NotificationTabView
  62. titles={['充電資訊', '活動優惠']}
  63. reservationAfter2025={parsedReservationAfter2025}
  64. passingThisPromotionToBell={parsedPassingThisPromotionToBell}
  65. />
  66. </View>
  67. </View>
  68. </SafeAreaView>
  69. );
  70. };
  71. export default NotificationPageComponent;