create-gufran-expo-app 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/lib/createApp.js +7 -2
  2. package/package.json +1 -1
  3. package/template/App.tsx +118 -0
  4. package/template/ReactotronConfig.js +5 -0
  5. package/template/android/app/build.gradle +184 -0
  6. package/template/android/app/debug.keystore +0 -0
  7. package/template/android/app/google-services.json +29 -0
  8. package/template/android/app/proguard-rules.pro +14 -0
  9. package/template/android/app/src/debug/AndroidManifest.xml +7 -0
  10. package/template/android/app/src/debugOptimized/AndroidManifest.xml +7 -0
  11. package/template/android/app/src/main/AndroidManifest.xml +28 -0
  12. package/template/android/app/src/main/assets/fonts/Outfit-Bold.ttf +0 -0
  13. package/template/android/app/src/main/assets/fonts/Outfit-Light.ttf +0 -0
  14. package/template/android/app/src/main/assets/fonts/Outfit-Medium.ttf +0 -0
  15. package/template/android/app/src/main/assets/fonts/Outfit-Regular.ttf +0 -0
  16. package/template/android/app/src/main/assets/fonts/Outfit-SemiBold.ttf +0 -0
  17. package/template/android/app/src/main/java/com/club/yakka/MainActivity.kt +61 -0
  18. package/template/android/app/src/main/java/com/club/yakka/MainApplication.kt +60 -0
  19. package/template/android/app/src/main/res/drawable/ic_launcher_background.xml +6 -0
  20. package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  21. package/template/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png +0 -0
  22. package/template/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png +0 -0
  23. package/template/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png +0 -0
  24. package/template/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png +0 -0
  25. package/template/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png +0 -0
  26. package/template/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  27. package/template/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  28. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  29. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp +0 -0
  30. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  31. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  32. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp +0 -0
  33. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  34. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  35. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp +0 -0
  36. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  37. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  38. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp +0 -0
  39. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  40. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  41. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp +0 -0
  42. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  43. package/template/android/app/src/main/res/values/colors.xml +6 -0
  44. package/template/android/app/src/main/res/values/strings.xml +5 -0
  45. package/template/android/app/src/main/res/values/styles.xml +14 -0
  46. package/template/android/app/src/main/res/values-night/colors.xml +1 -0
  47. package/template/android/build.gradle +33 -0
  48. package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  49. package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  50. package/template/android/gradle.properties +65 -0
  51. package/template/android/gradlew +251 -0
  52. package/template/android/gradlew.bat +94 -0
  53. package/template/android/settings.gradle +39 -0
  54. package/template/app.json +69 -0
  55. package/template/assets/adaptive-icon.png +0 -0
  56. package/template/assets/adaptive-icon1.png +0 -0
  57. package/template/assets/app_icon.png +0 -0
  58. package/template/assets/favicon.png +0 -0
  59. package/template/assets/icon.png +0 -0
  60. package/template/assets/splash-icon.png +0 -0
  61. package/template/babel-plugin-disable-font-scaling.js +41 -0
  62. package/template/babel.config.js +28 -0
  63. package/template/firebase.json +5 -0
  64. package/template/index.ts +24 -0
  65. package/template/ios/.xcode.env +11 -0
  66. package/template/ios/ClubYakka/AppDelegate.swift +74 -0
  67. package/template/ios/ClubYakka/ClubYakka-Bridging-Header.h +3 -0
  68. package/template/ios/ClubYakka/ClubYakka.entitlements +8 -0
  69. package/template/ios/ClubYakka/GoogleService-Info.plist +30 -0
  70. package/template/ios/ClubYakka/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
  71. package/template/ios/ClubYakka/Images.xcassets/AppIcon.appiconset/Contents.json +14 -0
  72. package/template/ios/ClubYakka/Images.xcassets/Contents.json +6 -0
  73. package/template/ios/ClubYakka/Images.xcassets/SplashScreenBackground.colorset/Contents.json +20 -0
  74. package/template/ios/ClubYakka/Images.xcassets/SplashScreenLegacy.imageset/Contents.json +23 -0
  75. package/template/ios/ClubYakka/Images.xcassets/SplashScreenLegacy.imageset/image.png +0 -0
  76. package/template/ios/ClubYakka/Images.xcassets/SplashScreenLegacy.imageset/image@2x.png +0 -0
  77. package/template/ios/ClubYakka/Images.xcassets/SplashScreenLegacy.imageset/image@3x.png +0 -0
  78. package/template/ios/ClubYakka/Info.plist +101 -0
  79. package/template/ios/ClubYakka/PrivacyInfo.xcprivacy +50 -0
  80. package/template/ios/ClubYakka/SplashScreen.storyboard +48 -0
  81. package/template/ios/ClubYakka/Supporting/Expo.plist +12 -0
  82. package/template/ios/ClubYakka.xcodeproj/project.pbxproj +669 -0
  83. package/template/ios/ClubYakka.xcodeproj/xcshareddata/xcschemes/ClubYakka.xcscheme +88 -0
  84. package/template/ios/ClubYakka.xcworkspace/contents.xcworkspacedata +10 -0
  85. package/template/ios/ClubYakka.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
  86. package/template/ios/Podfile +84 -0
  87. package/template/ios/Podfile.lock +2698 -0
  88. package/template/ios/Podfile.properties.json +8 -0
  89. package/template/metro.config.js +17 -0
  90. package/template/package.json +70 -0
  91. package/template/patches/react-native-background-upload+6.6.0.patch +704 -0
  92. package/template/react-native.config.js +7 -0
  93. package/template/src/assets/fonts/Outfit-Bold.ttf +0 -0
  94. package/template/src/assets/fonts/Outfit-Light.ttf +0 -0
  95. package/template/src/assets/fonts/Outfit-Medium.ttf +0 -0
  96. package/template/src/assets/fonts/Outfit-Regular.ttf +0 -0
  97. package/template/src/assets/fonts/Outfit-SemiBold.ttf +0 -0
  98. package/template/src/assets/icons/BG.svg +33 -0
  99. package/template/src/assets/icons/Ic_Users.svg +6 -0
  100. package/template/src/assets/icons/arrow-left-white.svg +4 -0
  101. package/template/src/assets/icons/arrow-left.svg +4 -0
  102. package/template/src/assets/icons/bell.svg +4 -0
  103. package/template/src/assets/icons/bottomSheetIcone.svg +3 -0
  104. package/template/src/assets/icons/call.svg +4 -0
  105. package/template/src/assets/icons/camera.svg +0 -0
  106. package/template/src/assets/icons/chatAppleGreenBG.svg +22 -0
  107. package/template/src/assets/icons/check.svg +4 -0
  108. package/template/src/assets/icons/check_Radio.svg +4 -0
  109. package/template/src/assets/icons/chevron-right.svg +3 -0
  110. package/template/src/assets/icons/clubDefauldImage.png +0 -0
  111. package/template/src/assets/icons/curvBackgroundView.svg +3 -0
  112. package/template/src/assets/icons/defaultClub.png +0 -0
  113. package/template/src/assets/icons/email.svg +3 -0
  114. package/template/src/assets/icons/emptyUser.svg +5 -0
  115. package/template/src/assets/icons/eye-Hide.svg +8 -0
  116. package/template/src/assets/icons/eye.svg +4 -0
  117. package/template/src/assets/icons/gallery.svg +4 -0
  118. package/template/src/assets/icons/home.svg +4 -0
  119. package/template/src/assets/icons/ic_Calendar.svg +14 -0
  120. package/template/src/assets/icons/ic_Calendar_blue.svg +12 -0
  121. package/template/src/assets/icons/ic_Calendar_white.svg +12 -0
  122. package/template/src/assets/icons/ic_Chat.svg +14 -0
  123. package/template/src/assets/icons/ic_ChatAppleGreen.svg +21 -0
  124. package/template/src/assets/icons/ic_ChatAppleWhite.svg +21 -0
  125. package/template/src/assets/icons/ic_Download.svg +6 -0
  126. package/template/src/assets/icons/ic_Events.svg +6 -0
  127. package/template/src/assets/icons/ic_HeadCoachIcon.svg +3 -0
  128. package/template/src/assets/icons/ic_Membership.svg +10 -0
  129. package/template/src/assets/icons/ic_Notification.svg +6 -0
  130. package/template/src/assets/icons/ic_Raffles.svg +14 -0
  131. package/template/src/assets/icons/ic_Referral_Members.svg +12 -0
  132. package/template/src/assets/icons/ic_Shop.svg +13 -0
  133. package/template/src/assets/icons/ic_Teams.svg +8 -0
  134. package/template/src/assets/icons/ic_Volunteer.svg +9 -0
  135. package/template/src/assets/icons/ic_add.svg +3 -0
  136. package/template/src/assets/icons/ic_addCircle.svg +5 -0
  137. package/template/src/assets/icons/ic_chatSend.svg +4 -0
  138. package/template/src/assets/icons/ic_chat_blue_bg.svg +22 -0
  139. package/template/src/assets/icons/ic_clock_blue.svg +4 -0
  140. package/template/src/assets/icons/ic_delete.svg +8 -0
  141. package/template/src/assets/icons/ic_more.svg +5 -0
  142. package/template/src/assets/icons/ic_mute.svg +10 -0
  143. package/template/src/assets/icons/ic_pdf.svg +3 -0
  144. package/template/src/assets/icons/ic_pending_AppleGreen.svg +11 -0
  145. package/template/src/assets/icons/ic_right_appleGreen.svg +11 -0
  146. package/template/src/assets/icons/ic_unread_chat_blue_bg.svg +23 -0
  147. package/template/src/assets/icons/ic_volunteer_Member.svg +8 -0
  148. package/template/src/assets/icons/index.ts +144 -0
  149. package/template/src/assets/icons/location-blue.svg +4 -0
  150. package/template/src/assets/icons/location-white.svg +4 -0
  151. package/template/src/assets/icons/location.svg +4 -0
  152. package/template/src/assets/icons/lock.svg +5 -0
  153. package/template/src/assets/icons/log-out.svg +5 -0
  154. package/template/src/assets/icons/login_logo.svg +9 -0
  155. package/template/src/assets/icons/mail.svg +4 -0
  156. package/template/src/assets/icons/or_saprater.svg +5 -0
  157. package/template/src/assets/icons/password.svg +4 -0
  158. package/template/src/assets/icons/profile-appleGreen.svg +6 -0
  159. package/template/src/assets/icons/search.svg +3 -0
  160. package/template/src/assets/icons/settings.svg +4 -0
  161. package/template/src/assets/icons/success.svg +4 -0
  162. package/template/src/assets/icons/unCheck_Radio.svg +3 -0
  163. package/template/src/assets/icons/uncheck.svg +3 -0
  164. package/template/src/assets/icons/upload_Image.svg +6 -0
  165. package/template/src/assets/icons/upload_Image_Member.svg +6 -0
  166. package/template/src/assets/icons/user.svg +4 -0
  167. package/template/src/assets/icons/wifi.svg +1 -0
  168. package/template/src/assets/images/Splash.png +0 -0
  169. package/template/src/assets/images/SplashLogo.png +0 -0
  170. package/template/src/assets/images/background.png +0 -0
  171. package/template/src/assets/images/clubDefauldImage.png +0 -0
  172. package/template/src/assets/images/index.tsx +9 -0
  173. package/template/src/assets/index.ts +1 -0
  174. package/template/src/components/common/AddMemberModal.tsx +543 -0
  175. package/template/src/components/common/AppLoader.tsx +91 -0
  176. package/template/src/components/common/Button.tsx +173 -0
  177. package/template/src/components/common/ClubCard.tsx +248 -0
  178. package/template/src/components/common/Icon.tsx +93 -0
  179. package/template/src/components/common/IconAlt.tsx +65 -0
  180. package/template/src/components/common/IconButton.tsx +92 -0
  181. package/template/src/components/common/ImagePicker.tsx +451 -0
  182. package/template/src/components/common/LoadingSpinner.tsx +30 -0
  183. package/template/src/components/common/OTPInput.tsx +128 -0
  184. package/template/src/components/common/ReminderCalendar.tsx +129 -0
  185. package/template/src/components/common/ReminderCardItem.tsx +91 -0
  186. package/template/src/components/common/SafeAreaWrapper.tsx +27 -0
  187. package/template/src/components/common/SetReminderModal.tsx +308 -0
  188. package/template/src/components/common/SlowInternet.js +57 -0
  189. package/template/src/components/common/TeamCard.tsx +297 -0
  190. package/template/src/components/common/TextInput.tsx +227 -0
  191. package/template/src/components/common/ToastConfig.tsx +103 -0
  192. package/template/src/components/common/ToastManager.ts +86 -0
  193. package/template/src/components/common/UploadProgressModal.tsx +284 -0
  194. package/template/src/components/common/WrapperContainer.tsx +39 -0
  195. package/template/src/components/common/index.ts +19 -0
  196. package/template/src/constants/Constants.tsx +7 -0
  197. package/template/src/constants/Fonts.tsx +30 -0
  198. package/template/src/constants/index.ts +45 -0
  199. package/template/src/constants/strings.ts +211 -0
  200. package/template/src/constants/theme.ts +72 -0
  201. package/template/src/contexts/AuthContext.tsx +268 -0
  202. package/template/src/contexts/index.ts +2 -0
  203. package/template/src/hooks/index.ts +3 -0
  204. package/template/src/hooks/useImageUpload.ts +199 -0
  205. package/template/src/index.ts +8 -0
  206. package/template/src/navigation/AuthStack.tsx +67 -0
  207. package/template/src/navigation/MainStack.tsx +183 -0
  208. package/template/src/navigation/MiddleStack.tsx +35 -0
  209. package/template/src/navigation/RootNavigator.tsx +101 -0
  210. package/template/src/navigation/index.ts +5 -0
  211. package/template/src/navigation/navigationRef.ts +5 -0
  212. package/template/src/providers/QueryProvider.tsx +30 -0
  213. package/template/src/screens/DetailsScreen.tsx +271 -0
  214. package/template/src/screens/HomeScreen.tsx +736 -0
  215. package/template/src/screens/ProfileScreen.tsx +202 -0
  216. package/template/src/screens/SettingsScreen.tsx +253 -0
  217. package/template/src/screens/SportHubScreen.tsx +280 -0
  218. package/template/src/screens/auth/AddMamber.tsx +428 -0
  219. package/template/src/screens/auth/ForgotPasswordScreen.tsx +176 -0
  220. package/template/src/screens/auth/LoginScreen.tsx +286 -0
  221. package/template/src/screens/auth/OTPVerifyScreen.tsx +359 -0
  222. package/template/src/screens/auth/RegisterScreen.tsx +430 -0
  223. package/template/src/screens/auth/SuccessScreen.tsx +201 -0
  224. package/template/src/screens/auth/WalcomeScreen.tsx +274 -0
  225. package/template/src/screens/auth/index.ts +8 -0
  226. package/template/src/screens/chat/ChatScreen.tsx +1819 -0
  227. package/template/src/screens/chat/ChatThreadsScreen.tsx +360 -0
  228. package/template/src/screens/chat/ReportMessageScreen.tsx +238 -0
  229. package/template/src/screens/clubs/Announcements.tsx +426 -0
  230. package/template/src/screens/clubs/BuyRaffleTicketsScreen.tsx +568 -0
  231. package/template/src/screens/clubs/ClubDeteils.tsx +497 -0
  232. package/template/src/screens/clubs/JoinClub.tsx +841 -0
  233. package/template/src/screens/events/EventScreen.tsx +460 -0
  234. package/template/src/screens/index.ts +42 -0
  235. package/template/src/screens/raffles/MyReferralMembersScreen.tsx +758 -0
  236. package/template/src/screens/raffles/RaffleDetailsScreen.tsx +762 -0
  237. package/template/src/screens/raffles/RafflesScreen.tsx +495 -0
  238. package/template/src/screens/raffles/SetRaffleReminderScreen.tsx +390 -0
  239. package/template/src/screens/teams/JoinTeamScreen.tsx +464 -0
  240. package/template/src/screens/teams/MyTeamDetailsScreen.tsx +979 -0
  241. package/template/src/screens/teams/MyTeamScreen.tsx +568 -0
  242. package/template/src/screens/teams/PendingRequestsScreen.tsx +426 -0
  243. package/template/src/screens/volunteerOpportunities/SetReminderScreen.tsx +631 -0
  244. package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesDetailsScreen.tsx +1049 -0
  245. package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesScreen.tsx +608 -0
  246. package/template/src/services/api.ts +167 -0
  247. package/template/src/services/authService.ts +422 -0
  248. package/template/src/services/index.ts +5 -0
  249. package/template/src/services/mainServices.ts +1963 -0
  250. package/template/src/stores/authStore.ts +159 -0
  251. package/template/src/stores/index.ts +2 -0
  252. package/template/src/types/index.ts +85 -0
  253. package/template/src/types/navigation.ts +206 -0
  254. package/template/src/utils/AzureUploaderService.ts +371 -0
  255. package/template/src/utils/ClubSearchManager.ts +222 -0
  256. package/template/src/utils/NotificationManager.ts +503 -0
  257. package/template/src/utils/UploadDebugUtil.ts +107 -0
  258. package/template/src/utils/imagePicker.ts +321 -0
  259. package/template/src/utils/index.ts +111 -0
  260. package/template/src/utils/permissions.ts +277 -0
  261. package/template/src/utils/scaling.ts +14 -0
  262. package/template/src/utils/storage.ts +247 -0
  263. package/template/src/utils/usePermissions.ts +275 -0
  264. package/template/src/utils/validation.ts +340 -0
  265. package/template/tsconfig.json +50 -0
  266. package/template/types/svg.d.ts +6 -0
@@ -0,0 +1,426 @@
1
+ import React, { useCallback, useMemo } from 'react';
2
+ import { View, Text, StyleSheet, FlatList, StatusBar, Platform, TouchableOpacity, Image, RefreshControl, Keyboard, ActivityIndicator } from 'react-native';
3
+ import { SafeAreaView } from 'react-native-safe-area-context';
4
+ import { Strings, theme } from '@constants';
5
+ import { moderateScale } from '@utils/scaling';
6
+ import { Fonts } from '@constants/Fonts';
7
+ import SVG from '@assets/icons';
8
+ import { AnnouncementsScreenProps } from '@navigation';
9
+ import { useInfiniteAnnouncements, Announcement } from '@services/mainServices';
10
+
11
+ export const Announcements: React.FC<AnnouncementsScreenProps> = ({ navigation, route }) => {
12
+ const { selectedClub, selectedMember: initialSelectedMember } = route?.params ?? {}
13
+ const clubId = selectedClub?.id || 0;
14
+ console.log("Announcements selectedClub", selectedClub);
15
+ const pageSize = 10; // Default page size
16
+
17
+ // Use infinite query for announcements
18
+ const {
19
+ data,
20
+ isLoading,
21
+ isError,
22
+ error,
23
+ fetchNextPage,
24
+ hasNextPage,
25
+ isFetchingNextPage,
26
+ refetch,
27
+ isRefetching,
28
+ } = useInfiniteAnnouncements(clubId, pageSize);
29
+
30
+ // Flatten all pages into a single array
31
+ const announcementsData = useMemo(() => {
32
+ if (!data?.pages) return [];
33
+ return data.pages.flatMap(page => {
34
+ const pageData = page?.data?.data;
35
+ if (!pageData) return [];
36
+
37
+ // Handle both structures: { announcements: [] } or direct array
38
+ if (Array.isArray(pageData)) {
39
+ return pageData;
40
+ }
41
+
42
+ // Handle object structure with announcements property
43
+ if (pageData && typeof pageData === 'object' && 'announcements' in pageData) {
44
+ return pageData.announcements || [];
45
+ }
46
+
47
+ return [];
48
+ });
49
+ }, [data]);
50
+
51
+ const keyExtractor = (item: Announcement, index: number): string => {
52
+ // Create a unique key using message and sentOn date
53
+ const messageHash = item.message?.substring(0, 20) || '';
54
+ const dateHash = item.sentOn || index.toString();
55
+ return `announcement-${dateHash}-${index}`;
56
+ };
57
+
58
+ // Pull to refresh
59
+ const onRefresh = useCallback(async () => {
60
+ await refetch();
61
+ }, [refetch]);
62
+
63
+ // Handle load more when reaching the end
64
+ const handleLoadMore = useCallback(async () => {
65
+ console.log('handleLoadMore called - hasNextPage:', hasNextPage, 'isFetchingNextPage:', isFetchingNextPage);
66
+ if (hasNextPage && !isFetchingNextPage) {
67
+ console.log('Fetching next page...');
68
+ await fetchNextPage();
69
+ } else {
70
+ console.log('Not fetching - hasNextPage:', hasNextPage, 'isFetchingNextPage:', isFetchingNextPage);
71
+ }
72
+ }, [hasNextPage, isFetchingNextPage, fetchNextPage]);
73
+
74
+
75
+
76
+
77
+ const renderEmptyComponent = () => {
78
+ if (isLoading) {
79
+ return (
80
+ <View style={styles.emptyContainer}>
81
+ <ActivityIndicator size="large" color={theme.colors.primary} />
82
+ <Text style={styles.emptyListText}>Loading announcements...</Text>
83
+ </View>
84
+ );
85
+ }
86
+
87
+ if (isError) {
88
+ return (
89
+ <View style={styles.emptyContainer}>
90
+ <Text style={styles.errorText}>Failed to load announcements</Text>
91
+ <Text style={styles.emptySubText}>{error?.message || 'Please try again'}</Text>
92
+ <TouchableOpacity style={styles.retryButton} onPress={() => refetch()}>
93
+ <Text style={styles.retryButtonText}>Retry</Text>
94
+ </TouchableOpacity>
95
+ </View>
96
+ );
97
+ }
98
+
99
+ return (
100
+ <View style={styles.emptyContainer}>
101
+ <Text style={styles.emptyListText}>No announcements found</Text>
102
+ <Text style={styles.emptySubText}>Try refreshing or check back later</Text>
103
+ </View>
104
+ );
105
+ };
106
+
107
+ const renderFooter = () => {
108
+ if (!isFetchingNextPage) return null;
109
+ return (
110
+ <View style={styles.footerLoader}>
111
+ <ActivityIndicator size="small" color={theme.colors.primary} />
112
+ <Text style={styles.footerText}>Loading more...</Text>
113
+ </View>
114
+ );
115
+ };
116
+
117
+ const handleScroll = useCallback(() => {
118
+ Keyboard.dismiss();
119
+ }, []);
120
+
121
+
122
+
123
+ const formatSentOn = (sentOn?: string | number | Date): string => {
124
+ if (!sentOn) return '';
125
+
126
+ const tryFormat = (d: Date) => {
127
+ const day = String(d.getDate()).padStart(2, '0');
128
+ const month = String(d.getMonth() + 1).padStart(2, '0');
129
+ const year = d.getFullYear();
130
+ let hours = d.getHours();
131
+ const minutes = String(d.getMinutes()).padStart(2, '0');
132
+ const ampm = hours >= 12 ? 'pm' : 'am';
133
+ hours = hours % 12;
134
+ if (hours === 0) hours = 12;
135
+ return `${day}/${month}/${year}, ${hours}:${minutes} ${ampm}`;
136
+ };
137
+
138
+ let date = new Date(sentOn);
139
+
140
+ if (isNaN(date.getTime()) && typeof sentOn === 'string') {
141
+ // Fallback parser for formats like: "29 Oct 2025 07:13 PM"
142
+ const match = sentOn.match(/^(\d{1,2})\s([A-Za-z]{3})\s(\d{4})\s(\d{1,2}):(\d{2})\s?(AM|PM)$/i);
143
+ if (match) {
144
+ const [, dStr, monStr, yStr, hStr, mStr, apStr] = match;
145
+ const monthMap: Record<string, number> = {
146
+ Jan: 0, Feb: 1, Mar: 2, Apr: 3, May: 4, Jun: 5,
147
+ Jul: 6, Aug: 7, Sep: 8, Oct: 9, Nov: 10, Dec: 11,
148
+ };
149
+ const monthIndex = monthMap[monStr as keyof typeof monthMap];
150
+ if (monthIndex !== undefined) {
151
+ let hour24 = parseInt(hStr, 10) % 12;
152
+ const isPM = /pm/i.test(apStr);
153
+ if (isPM) hour24 += 12;
154
+ const year = parseInt(yStr, 10);
155
+ const day = parseInt(dStr, 10);
156
+ const minute = parseInt(mStr, 10);
157
+ date = new Date(year, monthIndex, day, hour24, minute, 0, 0);
158
+ }
159
+ }
160
+ }
161
+
162
+ if (isNaN(date.getTime())) return String(sentOn);
163
+
164
+ return tryFormat(date);
165
+ };
166
+
167
+
168
+ const renderAnnouncementItem = ({ item }: { item: Announcement }) => {
169
+ if (!item) return null;
170
+
171
+ return (
172
+ <View style={styles.announcementCard}>
173
+ {/* Message Content */}
174
+ <Text style={styles.announcementMessage}>{item.message}</Text>
175
+
176
+ {/* Image if available */}
177
+ {item.image && (
178
+ <Image
179
+ source={{ uri: item.image }}
180
+ style={styles.announcementImage}
181
+ resizeMode="cover"
182
+ />
183
+ )}
184
+
185
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
186
+
187
+ <Text style={styles.announcementBy}>By Club Admin</Text>
188
+
189
+ {/* Date/Time */}
190
+ {item.sentOn && (
191
+ <Text style={styles.announcementDate}>{formatSentOn(item.sentOn)}</Text>
192
+ )}
193
+ </View>
194
+ </View>
195
+ );
196
+ };
197
+
198
+
199
+ return (
200
+ <View style={styles.container}>
201
+ <StatusBar
202
+ barStyle="light-content"
203
+ backgroundColor={theme.colors.blue}
204
+ translucent={Platform.OS === 'android' ? true : false}
205
+ />
206
+ {Platform.OS === 'ios' && <View style={styles.statusBarBackground} />}
207
+ <SafeAreaView style={styles.header} >
208
+ <View style={{ flexDirection: 'row', paddingHorizontal: theme.spacing.lg }}>
209
+ <TouchableOpacity onPress={() => navigation.goBack()}>
210
+ <SVG.arrowLeft_white width={moderateScale(25)} height={moderateScale(25)} />
211
+ </TouchableOpacity>
212
+ <View style={{ flexDirection: 'row' }}>
213
+ <View style={styles.userConSty}>
214
+ {!!selectedClub?.clubImage ? (<Image
215
+ // onLoadEnd={() => setIsLoading(false)}
216
+ // onLoad={() => setIsLoading(true)}
217
+ // onLoadStart={() => setIsLoading(true)}
218
+ source={{ uri: selectedClub?.clubImage }}
219
+ resizeMode='cover'
220
+ style={styles.userDetailsSty} />
221
+ ) : (
222
+ <View style={styles.placeholderLogoHeader}>
223
+ <SVG.UsersIcon width={moderateScale(20)} height={moderateScale(20)} />
224
+ </View>
225
+ )}
226
+ </View>
227
+ <Text style={styles.userNameSty}>{selectedClub?.clubName || 'Unknown Club'}</Text>
228
+ </View>
229
+ </View>
230
+ <Text style={styles.headerTitle}>{Strings.Announcements.ANNOUNCEMENTS}</Text>
231
+ <View style={styles.content}>
232
+ <FlatList
233
+ data={announcementsData}
234
+ renderItem={renderAnnouncementItem}
235
+ keyExtractor={keyExtractor}
236
+ style={styles.clubsList}
237
+ showsVerticalScrollIndicator={false}
238
+ contentContainerStyle={styles.flatListContent}
239
+ removeClippedSubviews={false}
240
+ initialNumToRender={10}
241
+ ListEmptyComponent={renderEmptyComponent}
242
+ onScroll={handleScroll}
243
+ scrollEventThrottle={16}
244
+ refreshControl={
245
+ <RefreshControl
246
+ refreshing={isRefetching}
247
+ onRefresh={onRefresh}
248
+ colors={[theme.colors.primary]}
249
+ tintColor={theme.colors.primary}
250
+ />
251
+ }
252
+ onEndReached={handleLoadMore}
253
+ onEndReachedThreshold={0.5}
254
+ ListFooterComponent={renderFooter}
255
+ maxToRenderPerBatch={10}
256
+ updateCellsBatchingPeriod={50}
257
+ windowSize={10}
258
+ />
259
+ </View>
260
+ </SafeAreaView>
261
+
262
+ </View>
263
+ );
264
+ };
265
+
266
+ const styles = StyleSheet.create({
267
+ container: {
268
+ flex: 1,
269
+ backgroundColor: theme.colors.blue,
270
+ },
271
+ statusBarBackground: {
272
+ position: 'absolute',
273
+ top: 0,
274
+ left: 0,
275
+ right: 0,
276
+ height: Platform.OS === 'ios' ? 44 : 0, // Status bar height for iOS
277
+ backgroundColor: theme.colors.blue,
278
+ zIndex: 1000,
279
+ },
280
+ header: {
281
+ flex: 1,
282
+ backgroundColor: theme.colors.blue,
283
+ paddingVertical: theme.spacing.xs,
284
+ paddingTop: Platform.OS === 'android' ? theme.spacing.lg : theme.spacing.xs,
285
+ },
286
+ headerTitle: {
287
+ marginTop: moderateScale(20),
288
+ fontFamily: Fonts.outfitMedium,
289
+ fontSize: moderateScale(22),
290
+ color: theme.colors.white,
291
+ paddingHorizontal: theme.spacing.lg,
292
+ marginBottom: theme.spacing.sm,
293
+ },
294
+ content: {
295
+ flex: 1,
296
+ backgroundColor: theme.colors.white,
297
+ paddingHorizontal: theme.spacing.lg,
298
+ paddingTop: theme.spacing.md,
299
+ borderTopLeftRadius: moderateScale(30),
300
+ borderTopRightRadius: moderateScale(30),
301
+ },
302
+ clubsList: {
303
+ flex: 1,
304
+ },
305
+ flatListContent: {
306
+ paddingBottom: theme.spacing.xl,
307
+ },
308
+ emptyContainer: {
309
+ flex: 1,
310
+ justifyContent: 'center',
311
+ alignItems: 'center',
312
+ paddingVertical: theme.spacing.xl,
313
+ },
314
+ emptyListText: {
315
+ fontFamily: Fonts.outfitMedium,
316
+ fontSize: theme.typography.fontSize.md,
317
+ color: theme.colors.text,
318
+ textAlign: 'center',
319
+ marginBottom: theme.spacing.xs,
320
+ },
321
+ emptySubText: {
322
+ fontFamily: Fonts.outfitRegular,
323
+ fontSize: theme.typography.fontSize.sm,
324
+ color: theme.colors.textSecondary,
325
+ textAlign: 'center',
326
+ },
327
+ footerLoader: {
328
+ flexDirection: 'row',
329
+ justifyContent: 'center',
330
+ alignItems: 'center',
331
+ paddingVertical: theme.spacing.md,
332
+ gap: theme.spacing.sm,
333
+ },
334
+ footerText: {
335
+ fontFamily: Fonts.outfitMedium,
336
+ fontSize: theme.typography.fontSize.sm,
337
+ color: theme.colors.textSecondary,
338
+ },
339
+ errorText: {
340
+ fontFamily: Fonts.outfitMedium,
341
+ fontSize: theme.typography.fontSize.md,
342
+ color: theme.colors.error,
343
+ textAlign: 'center',
344
+ marginBottom: theme.spacing.md,
345
+ },
346
+ retryButton: {
347
+ backgroundColor: theme.colors.primary,
348
+ paddingHorizontal: theme.spacing.lg,
349
+ paddingVertical: theme.spacing.sm,
350
+ borderRadius: theme.borderRadius.md,
351
+ },
352
+ retryButtonText: {
353
+ fontFamily: Fonts.outfitMedium,
354
+ fontSize: theme.typography.fontSize.md,
355
+ color: theme.colors.white,
356
+ textAlign: 'center',
357
+ },
358
+ userConSty: {
359
+ marginHorizontal: moderateScale(10),
360
+ width: moderateScale(30),
361
+ height: moderateScale(30),
362
+ borderRadius: moderateScale(15),
363
+ borderWidth: 1.5,
364
+ borderColor: theme.colors.imageBorder,
365
+ backgroundColor: theme.colors.background,
366
+ alignItems: 'center',
367
+ justifyContent: 'center'
368
+ },
369
+ userNameSty: {
370
+ marginTop: moderateScale(5),
371
+ color: theme.colors.white,
372
+ fontFamily: Fonts.outfitMedium,
373
+ fontSize: moderateScale(15)
374
+ },
375
+ userDetailsSty: {
376
+ width: moderateScale(30),
377
+ height: moderateScale(30),
378
+ borderRadius: moderateScale(15),
379
+ },
380
+ placeholderLogoHeader: {
381
+ width: moderateScale(20),
382
+ height: moderateScale(20),
383
+ borderRadius: moderateScale(10),
384
+ alignItems: 'center',
385
+ justifyContent: 'center'
386
+ },
387
+
388
+ // New Announcement Card Styles
389
+ announcementCard: {
390
+ backgroundColor: theme.colors.lightLavenderGray,
391
+ borderRadius: moderateScale(12),
392
+ padding: theme.spacing.md,
393
+ marginBottom: theme.spacing.md,
394
+ shadowColor: '#000',
395
+ shadowOffset: { width: 0, height: 2 },
396
+ shadowOpacity: 0.1,
397
+ shadowRadius: 4,
398
+ elevation: 3,
399
+ },
400
+ announcementMessage: {
401
+ fontFamily: Fonts.outfitRegular,
402
+ fontSize: moderateScale(15),
403
+ color: theme.colors.text,
404
+ lineHeight: moderateScale(22),
405
+ marginBottom: theme.spacing.sm,
406
+ },
407
+ announcementImage: {
408
+ width: '100%',
409
+ height: moderateScale(200),
410
+ borderRadius: moderateScale(8),
411
+ marginBottom: theme.spacing.sm,
412
+ backgroundColor: theme.colors.border,
413
+ },
414
+ announcementDate: {
415
+ fontFamily: Fonts.outfitRegular,
416
+ fontSize: moderateScale(12),
417
+ color: theme.colors.textSecondary,
418
+ marginTop: theme.spacing.xs,
419
+ },
420
+ announcementBy: {
421
+ fontFamily: Fonts.outfitRegular,
422
+ fontSize: moderateScale(12),
423
+ color: theme.colors.black,
424
+ marginTop: theme.spacing.xs,
425
+ },
426
+ });