create-gufran-expo-app 2.0.0 → 2.0.2

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,568 @@
1
+ import React, { useState, useEffect, useCallback, useRef } from 'react';
2
+ import { View, Text, StyleSheet, FlatList, StatusBar, Platform, TouchableOpacity, Image, RefreshControl, ActivityIndicator, Keyboard } from 'react-native';
3
+ import { MyTeamScreen as MyTeamScreenProps } from '../../types/navigation';
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 { SafeAreaView } from 'react-native-safe-area-context';
9
+ import { useInfiniteMyTeams } from '../../services/mainServices';
10
+ import { useQueryClient } from '@tanstack/react-query';
11
+ import { TeamCard } from '../../components/common';
12
+ import ToastManager from '../../components/common/ToastManager';
13
+ import { getApiErrorInfo, useGetImageUrl } from '../../services';
14
+ import { useFocusEffect } from '@react-navigation/native';
15
+ const PAGE_SIZE = 10;
16
+
17
+ export const MyTeamScreen: React.FC<MyTeamScreenProps> = ({ navigation, route }) => {
18
+ const { selectedClub, selectedMember: initialSelectedMember } = route?.params ?? {}
19
+ const [isRefreshing, setIsRefreshing] = useState(false);
20
+ const [searchQuery, setSearchQuery] = useState('');
21
+ const [searchTimeout, setSearchTimeout] = useState<NodeJS.Timeout | null>(null);
22
+ const [joinClubImageUrls, setJoinClubImageUrls] = useState<Record<number, string>>({});
23
+ const queryClient = useQueryClient();
24
+ const getImageUrlMutation = useGetImageUrl();
25
+
26
+
27
+
28
+ const createNavigationData = () => {
29
+ const navigationData: any = {
30
+ selectedClub: selectedClub,
31
+ selectedMember: initialSelectedMember
32
+ };
33
+ console.log('Navigation data being passed:', navigationData);
34
+ return navigationData;
35
+ };
36
+
37
+
38
+
39
+ const keyExtractor = (item: any, index: number) => {
40
+ // Create a more robust key that combines multiple attributes to ensure uniqueness
41
+ const id = item?.id?.toString() || '';
42
+ const name = item?.name || item?.clubName || '';
43
+ const clubCode = item?.clubCode || item?.uniqueCode || '';
44
+ const timestamp = item?.createdAt || item?.timestamp || '';
45
+
46
+ // Create a unique composite key using multiple attributes
47
+ const keyParts = [id, name, clubCode, timestamp].filter(part => part && part.toString().trim() !== '');
48
+
49
+ if (keyParts.length > 0) {
50
+ return `club-${keyParts.join('-')}-${index}`;
51
+ }
52
+
53
+ // Ultimate fallback with index to ensure uniqueness
54
+ return `club-unknown-${index}`;
55
+ };
56
+
57
+
58
+ const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, isError, refetch, error } = useInfiniteMyTeams(selectedClub?.selectedMember?.id, PAGE_SIZE);
59
+ console.log("MyTeamScreen data", JSON.stringify(data));
60
+
61
+ // const pandingRequests = data?.pages
62
+ const pendingRequestsCount = data?.pages?.reduce((sum: number, p: any) => sum + (p?.data?.data?.pendingRequest ?? 0), 0) ?? 0;
63
+
64
+
65
+ // Flatten all pages into a single array and add clubImageUrl from state
66
+ const allClubs = data?.pages?.flatMap(page =>
67
+ (page?.data?.data?.members || []).map((club: any) => ({
68
+ ...club,
69
+ clubImageUrl: joinClubImageUrls[club.id] || undefined
70
+ }))
71
+ ) || [];
72
+
73
+
74
+ useFocusEffect(useCallback(() => {
75
+ refetch();
76
+ }, [refetch]));
77
+
78
+
79
+
80
+ // Pull to refresh
81
+ const onRefresh = useCallback(async () => {
82
+ try {
83
+ setIsRefreshing(true);
84
+ // Clear all cached data for this query to start fresh from page 0
85
+ queryClient.removeQueries({
86
+ queryKey: ['infiniteClubSearch', searchQuery, PAGE_SIZE]
87
+ });
88
+ // This will trigger a fresh fetch starting from page 0
89
+ await refetch();
90
+ } catch (error) {
91
+ console.error('Refresh failed:', error);
92
+ } finally {
93
+ setIsRefreshing(false);
94
+ }
95
+ }, [refetch, queryClient, searchQuery]);
96
+
97
+ // Cleanup timeout on unmount
98
+ useEffect(() => {
99
+ return () => {
100
+ if (searchTimeout) {
101
+ clearTimeout(searchTimeout);
102
+ }
103
+ };
104
+ }, [searchTimeout]);
105
+
106
+ // Load more data
107
+ const onEndReached = useCallback(() => {
108
+ if (isFetchingNextPage || !hasNextPage) return;
109
+ fetchNextPage();
110
+ }, [isFetchingNextPage, hasNextPage, fetchNextPage, allClubs.length]);
111
+
112
+ // Render loading footer
113
+ const renderFooter = () => {
114
+ if (!isFetchingNextPage) return null;
115
+ return (
116
+ <View style={styles.footerLoader}>
117
+ <ActivityIndicator size="small" color={theme.colors.primary} />
118
+ <Text style={styles.footerText}>Loading more teams...</Text>
119
+ </View>
120
+ );
121
+ };
122
+
123
+
124
+
125
+ const renderEmptyComponent = () => {
126
+ if (isLoading) return null;
127
+ return (
128
+ <View style={styles.emptyContainer}>
129
+ <Text style={styles.emptyListText}>No Teams found</Text>
130
+ <Text style={styles.emptySubText}>Try refreshing or check back later</Text>
131
+ </View>
132
+ );
133
+ };
134
+
135
+ const handleScroll = useCallback(() => {
136
+ Keyboard.dismiss();
137
+ }, []);
138
+
139
+
140
+
141
+ const getJoinClubImageUrls = async (clubItem: any) => {
142
+ if (clubItem?.clubImage == null) return;
143
+
144
+ // Skip if already fetched
145
+ if (joinClubImageUrls[clubItem.id] !== undefined) return;
146
+
147
+ const [folder, blobName] = clubItem?.clubImage.split('/');
148
+
149
+ try {
150
+ getImageUrlMutation.mutate({
151
+ containerName: folder,
152
+ blobName: blobName
153
+ }, {
154
+ onSuccess: (response) => {
155
+ const imageUrl = response?.data?.data?.url;
156
+ console.log('JoinClub Image URL response', response.data);
157
+
158
+ // Prefetch image into React Native cache to avoid blink when scrolling back
159
+ if (imageUrl) {
160
+ Image.prefetch(imageUrl).catch((prefetchError) => {
161
+ console.warn('JoinClub Image prefetch failed:', prefetchError);
162
+ });
163
+ }
164
+
165
+ // Simple state update instead of recreating entire query cache
166
+ setJoinClubImageUrls(prev => ({
167
+ ...prev,
168
+ [clubItem.id]: imageUrl
169
+ }));
170
+ },
171
+ onError: (error) => {
172
+ const errorInfo = getApiErrorInfo(error);
173
+ ToastManager.error(errorInfo.message);
174
+ setJoinClubImageUrls(prev => ({
175
+ ...prev,
176
+ [clubItem.id]: ""
177
+ }));
178
+ }
179
+ });
180
+ } catch (err) {
181
+ setJoinClubImageUrls(prev => ({
182
+ ...prev,
183
+ [clubItem.id]: ""
184
+ }));
185
+ }
186
+ };
187
+
188
+ const onJoinClubViewableItemsChanged = useCallback(
189
+ ({
190
+ viewableItems,
191
+ }: {
192
+ viewableItems: Array<{ item: any }>;
193
+ }) => {
194
+ const items = viewableItems.map(({ item }) => item);
195
+ items.forEach((item) => {
196
+ if (item && !item.clubImageUrl) {
197
+ console.log('JoinClub onViewableItemsChanged>>>>>', JSON.stringify(item));
198
+ getJoinClubImageUrls(item);
199
+ }
200
+ });
201
+ },
202
+ [getJoinClubImageUrls]
203
+ );
204
+
205
+ const joinClubViewabilityConfig = useRef({
206
+ viewAreaCoveragePercentThreshold: 50, // Increased threshold for better on-demand loading
207
+ minimumViewTime: 100, // Minimum time item must be visible before triggering
208
+ waitForInteraction: false, // Don't wait for user interaction
209
+ }).current;
210
+
211
+
212
+ const renderClubItem = ({ item }: any) => {
213
+ return (
214
+ <TeamCard
215
+ team={item}
216
+ onChat={true}
217
+ onChatPress={() => {
218
+
219
+ navigation.navigate('ChatThreads', {
220
+ team: item,
221
+ selectedMember: initialSelectedMember,
222
+ selectedClub: selectedClub
223
+ });
224
+ }}
225
+
226
+ onPress={() => {
227
+ navigation.navigate('MyTeamDetails', {
228
+ club: item,
229
+ selectedMember: initialSelectedMember,
230
+ selectedClub: selectedClub
231
+ });
232
+ }}
233
+ />
234
+ );
235
+ };
236
+
237
+ return (
238
+ <View style={styles.container}>
239
+ <StatusBar
240
+ barStyle="light-content"
241
+ backgroundColor={theme.colors.blue}
242
+ translucent={Platform.OS === 'android' ? true : false}
243
+ />
244
+ {Platform.OS === 'ios' && <View style={styles.statusBarBackground} />}
245
+ <SafeAreaView style={styles.header} >
246
+ <View style={{ flexDirection: 'row', paddingHorizontal: theme.spacing.lg }}>
247
+ <TouchableOpacity onPress={() => navigation.goBack()}>
248
+ <SVG.arrowLeft_white width={moderateScale(25)} height={moderateScale(25)} />
249
+ </TouchableOpacity>
250
+ <View style={{ flexDirection: 'row' }}>
251
+ <View style={styles.userConSty}>
252
+ {!!selectedClub?.clubImage ? (<Image
253
+ // onLoadEnd={() => setIsLoading(false)}
254
+ // onLoad={() => setIsLoading(true)}
255
+ // onLoadStart={() => setIsLoading(true)}
256
+ source={{ uri: selectedClub?.clubImage }} style={styles.userDetailsSty}
257
+ resizeMode='cover'
258
+ />
259
+ ) : (
260
+ <View style={styles.placeholderLogoHeader}>
261
+ <SVG.UsersIcon width={moderateScale(20)} height={moderateScale(20)} />
262
+ </View>
263
+ )}
264
+ </View>
265
+ <Text style={styles.userNameSty}>{selectedClub?.clubName || 'Unknown Club'}</Text>
266
+ </View>
267
+ </View>
268
+ <Text style={styles.headerTitle}>{Strings.Teams.TEAMS}</Text>
269
+
270
+
271
+ <View style={styles.addMemberContainer}>
272
+ <TouchableOpacity style={styles.addMemberButton} onPress={() => navigation.navigate('JoinTeam', createNavigationData())}>
273
+ <SVG.icAdd width={moderateScale(20)} height={moderateScale(20)} />
274
+ <Text style={styles.addMemberButtonText}>{Strings.Teams.JOIN_TEAM_SUBTITLE}</Text>
275
+ </TouchableOpacity>
276
+
277
+ {pendingRequestsCount > 0 && (
278
+ <TouchableOpacity
279
+ style={{ alignItems: 'center', marginTop: moderateScale(10) }}
280
+ onPress={() => navigation.navigate('PendingRequests',createNavigationData())}
281
+ >
282
+ <Text style={[styles.addMemberButtonText, { textDecorationLine: 'underline' }]}>{`${pendingRequestsCount} ${Strings.Teams.PENDING_REQUEST}`}</Text>
283
+ </TouchableOpacity>
284
+ )}
285
+ </View>
286
+
287
+ <View style={styles.content}>
288
+ <Text style={styles.sectionTitle}>{Strings.Teams.MY_TEAMS_SECTION_TITLE}</Text>
289
+ <FlatList
290
+ data={allClubs}
291
+ renderItem={renderClubItem}
292
+ keyExtractor={keyExtractor}
293
+ style={styles.clubsList}
294
+ showsVerticalScrollIndicator={false}
295
+ contentContainerStyle={styles.flatListContent}
296
+ removeClippedSubviews={false}
297
+ initialNumToRender={10}
298
+ onEndReached={onEndReached}
299
+ onEndReachedThreshold={0.9}
300
+ ListFooterComponent={renderFooter}
301
+ ListEmptyComponent={renderEmptyComponent}
302
+ onViewableItemsChanged={onJoinClubViewableItemsChanged}
303
+ viewabilityConfig={joinClubViewabilityConfig}
304
+ onScroll={handleScroll}
305
+ scrollEventThrottle={16}
306
+ refreshControl={
307
+ <RefreshControl
308
+ refreshing={isRefreshing}
309
+ onRefresh={onRefresh}
310
+ colors={[theme.colors.primary]}
311
+ tintColor={theme.colors.primary}
312
+ />
313
+ }
314
+ />
315
+ </View>
316
+ </SafeAreaView>
317
+ </View>
318
+ );
319
+ };
320
+
321
+ const styles = StyleSheet.create({
322
+ container: {
323
+ flex: 1,
324
+ backgroundColor: theme.colors.blue,
325
+ },
326
+ statusBarBackground: {
327
+ position: 'absolute',
328
+ top: 0,
329
+ left: 0,
330
+ right: 0,
331
+ height: Platform.OS === 'ios' ? 44 : 0, // Status bar height for iOS
332
+ backgroundColor: theme.colors.blue,
333
+ zIndex: 1000,
334
+ },
335
+ header: {
336
+ flex: 1,
337
+ backgroundColor: theme.colors.blue,
338
+ paddingTop: theme.spacing.xs,
339
+ },
340
+ headerTitle: {
341
+ marginTop: moderateScale(10),
342
+ fontFamily: Fonts.outfitMedium,
343
+ fontSize: moderateScale(22),
344
+ color: theme.colors.white,
345
+ marginLeft: theme.spacing.lg
346
+ },
347
+ skipButton: {
348
+ alignSelf: 'flex-end',
349
+ paddingHorizontal: theme.spacing.sm,
350
+ paddingVertical: theme.spacing.xs,
351
+ },
352
+ skipButtonText: {
353
+ fontFamily: Fonts.outfitSemiBold,
354
+ fontSize: theme.typography.fontSize.md,
355
+ color: theme.colors.white,
356
+ },
357
+ addMemberContainer: {
358
+ marginTop: moderateScale(10),
359
+ backgroundColor: theme.colors.blue,
360
+ paddingHorizontal: theme.spacing.lg,
361
+ paddingBottom: theme.spacing.md,
362
+ },
363
+ addMemberButton: {
364
+ flexDirection: 'row',
365
+ alignItems: 'center',
366
+ justifyContent: 'center',
367
+ backgroundColor: 'transparent',
368
+ borderWidth: 1.5,
369
+ borderColor: theme.colors.appleGreen,
370
+ borderRadius: theme.borderRadius.xxl,
371
+ paddingVertical: theme.spacing.sm,
372
+ paddingHorizontal: theme.spacing.lg,
373
+ gap: theme.spacing.sm,
374
+ },
375
+ addMemberButtonText: {
376
+ fontFamily: Fonts.outfitMedium,
377
+ fontSize: theme.typography.fontSize.md,
378
+ color: theme.colors.appleGreen,
379
+ },
380
+ content: {
381
+ flex: 1,
382
+ backgroundColor: theme.colors.background,
383
+ paddingHorizontal: theme.spacing.lg,
384
+ paddingTop: theme.spacing.md,
385
+ borderTopLeftRadius: moderateScale(30),
386
+ borderTopRightRadius: moderateScale(30),
387
+ },
388
+ sectionTitle: {
389
+ fontFamily: Fonts.outfitMedium,
390
+ fontSize: theme.typography.fontSize.xs,
391
+ color: theme.colors.blue,
392
+ marginBottom: theme.spacing.md,
393
+ letterSpacing: 0.5,
394
+ },
395
+ clubsList: {
396
+ flex: 1,
397
+ },
398
+ flatListContent: {
399
+ paddingBottom: theme.spacing.xl,
400
+ },
401
+ emptyContainer: {
402
+ flex: 1,
403
+ justifyContent: 'center',
404
+ alignItems: 'center',
405
+ paddingVertical: theme.spacing.xl,
406
+ },
407
+ bottomContainer: {
408
+ height: moderateScale(120),
409
+ paddingHorizontal: theme.spacing.lg,
410
+ paddingVertical: theme.spacing.md,
411
+ backgroundColor: theme.colors.white,
412
+ },
413
+ nextButton: {
414
+ width: '100%',
415
+ marginBottom: theme.spacing.md,
416
+ },
417
+ emptyListText: {
418
+ fontFamily: Fonts.outfitMedium,
419
+ fontSize: theme.typography.fontSize.md,
420
+ color: theme.colors.text,
421
+ textAlign: 'center',
422
+ marginBottom: theme.spacing.xs,
423
+ },
424
+ emptySubText: {
425
+ fontFamily: Fonts.outfitRegular,
426
+ fontSize: theme.typography.fontSize.sm,
427
+ color: theme.colors.textSecondary,
428
+ textAlign: 'center',
429
+ },
430
+ footerLoader: {
431
+ flexDirection: 'row',
432
+ justifyContent: 'center',
433
+ alignItems: 'center',
434
+ paddingVertical: theme.spacing.md,
435
+ gap: theme.spacing.sm,
436
+ },
437
+ footerText: {
438
+ fontFamily: Fonts.outfitMedium,
439
+ fontSize: theme.typography.fontSize.sm,
440
+ color: theme.colors.textSecondary,
441
+ },
442
+ errorText: {
443
+ fontFamily: Fonts.outfitMedium,
444
+ fontSize: theme.typography.fontSize.md,
445
+ color: theme.colors.error,
446
+ textAlign: 'center',
447
+ marginBottom: theme.spacing.md,
448
+ },
449
+ retryButton: {
450
+ backgroundColor: theme.colors.primary,
451
+ paddingHorizontal: theme.spacing.lg,
452
+ paddingVertical: theme.spacing.sm,
453
+ borderRadius: theme.borderRadius.md,
454
+ },
455
+ retryButtonText: {
456
+ fontFamily: Fonts.outfitMedium,
457
+ fontSize: theme.typography.fontSize.md,
458
+ color: theme.colors.white,
459
+ textAlign: 'center',
460
+ },
461
+ modalOverlay: {
462
+ flex: 1,
463
+ justifyContent: 'flex-end',
464
+ },
465
+ modalBackdrop: {
466
+ position: 'absolute',
467
+ top: 0,
468
+ left: 0,
469
+ right: 0,
470
+ bottom: 0,
471
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
472
+ },
473
+ modalContainer: {
474
+ backgroundColor: theme.colors.white,
475
+ borderTopLeftRadius: moderateScale(20),
476
+ borderTopRightRadius: moderateScale(20),
477
+ paddingHorizontal: theme.spacing.lg,
478
+ paddingTop: theme.spacing.sm,
479
+ paddingBottom: theme.spacing.xl,
480
+ height: '45%',
481
+ maxHeight: '45%',
482
+ },
483
+ dragHandle: {
484
+ width: moderateScale(40),
485
+ height: moderateScale(4),
486
+ backgroundColor: theme.colors.border,
487
+ borderRadius: moderateScale(2),
488
+ alignSelf: 'center',
489
+ marginBottom: theme.spacing.sm,
490
+ },
491
+ membersList: {
492
+ flex: 1,
493
+ },
494
+ memberListItem: {
495
+ height: moderateScale(70),
496
+ alignItems: 'center',
497
+ paddingVertical: theme.spacing.md,
498
+ flexDirection: 'row',
499
+ },
500
+ headerContainer: {
501
+ paddingVertical: theme.spacing.xs,
502
+ },
503
+ mamberHeaderTitle: {
504
+ fontFamily: Fonts.outfitSemiBold,
505
+ fontSize: moderateScale(14),
506
+ color: theme.colors.text,
507
+ },
508
+ profileImage: {
509
+ width: moderateScale(50),
510
+ height: moderateScale(50),
511
+ borderRadius: moderateScale(25),
512
+ marginRight: moderateScale(10),
513
+ },
514
+ memberName: {
515
+ fontFamily: Fonts.outfitSemiBold,
516
+ fontSize: moderateScale(14),
517
+ color: theme.colors.text,
518
+ },
519
+ memberNameContainer: {
520
+ flex: 1,
521
+ justifyContent: 'center',
522
+ },
523
+ memberNameSubtitle: {
524
+ fontFamily: Fonts.outfitMedium,
525
+ fontSize: moderateScale(12),
526
+ color: theme.colors.border,
527
+ },
528
+ searchInput: {
529
+ },
530
+ searchContainer: {
531
+ marginBottom: theme.spacing.md,
532
+ },
533
+ placeholderStyle: {
534
+ fontFamily: Fonts.outfitRegular,
535
+ fontSize: moderateScale(5),
536
+ color: theme.colors.textSecondary,
537
+ },
538
+ userConSty: {
539
+ marginHorizontal: moderateScale(10),
540
+ width: moderateScale(30),
541
+ height: moderateScale(30),
542
+ borderRadius: moderateScale(15),
543
+ borderWidth: 1.5,
544
+ borderColor: theme.colors.imageBorder,
545
+ backgroundColor: theme.colors.background,
546
+ alignItems: 'center',
547
+ justifyContent: 'center'
548
+ },
549
+ userNameSty: {
550
+ marginTop: moderateScale(5),
551
+ color: theme.colors.white,
552
+ fontFamily: Fonts.outfitMedium,
553
+ fontSize: moderateScale(15)
554
+ },
555
+ userDetailsSty: {
556
+ width: moderateScale(36),
557
+ height: moderateScale(36),
558
+ borderRadius: moderateScale(18),
559
+
560
+ },
561
+ placeholderLogoHeader: {
562
+ width: moderateScale(20),
563
+ height: moderateScale(20),
564
+ borderRadius: moderateScale(10),
565
+ alignItems: 'center',
566
+ justifyContent: 'center'
567
+ },
568
+ });