create-gufran-expo-app 2.0.4 → 2.0.6

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 (43) hide show
  1. package/README.md +60 -321
  2. package/bin/cli.js +0 -1
  3. package/package.json +4 -3
  4. package/template/src/navigation/AuthStack.tsx +6 -25
  5. package/template/src/navigation/MainStack.tsx +0 -148
  6. package/template/src/navigation/RootNavigator.tsx +4 -26
  7. package/template/src/navigation/index.ts +0 -1
  8. package/template/src/navigation/navigationRef.ts +1 -1
  9. package/template/src/screens/HomeScreen.tsx +3 -215
  10. package/template/src/screens/auth/LoginScreen.tsx +13 -13
  11. package/template/src/screens/auth/index.ts +1 -6
  12. package/template/src/screens/index.ts +0 -35
  13. package/template/src/services/api.ts +5 -5
  14. package/template/src/services/authService.ts +3 -299
  15. package/template/src/services/mainServices.ts +19 -1914
  16. package/template/src/types/navigation.ts +5 -155
  17. package/template/src/utils/index.ts +5 -8
  18. package/template/src/navigation/MiddleStack.tsx +0 -35
  19. package/template/src/screens/auth/AddMamber.tsx +0 -428
  20. package/template/src/screens/auth/ForgotPasswordScreen.tsx +0 -176
  21. package/template/src/screens/auth/OTPVerifyScreen.tsx +0 -359
  22. package/template/src/screens/auth/RegisterScreen.tsx +0 -430
  23. package/template/src/screens/auth/SuccessScreen.tsx +0 -201
  24. package/template/src/screens/chat/ChatScreen.tsx +0 -1819
  25. package/template/src/screens/chat/ChatThreadsScreen.tsx +0 -360
  26. package/template/src/screens/chat/ReportMessageScreen.tsx +0 -238
  27. package/template/src/screens/clubs/Announcements.tsx +0 -426
  28. package/template/src/screens/clubs/BuyRaffleTicketsScreen.tsx +0 -568
  29. package/template/src/screens/clubs/ClubDeteils.tsx +0 -497
  30. package/template/src/screens/clubs/JoinClub.tsx +0 -841
  31. package/template/src/screens/events/EventScreen.tsx +0 -460
  32. package/template/src/screens/raffles/MyReferralMembersScreen.tsx +0 -758
  33. package/template/src/screens/raffles/RaffleDetailsScreen.tsx +0 -762
  34. package/template/src/screens/raffles/RafflesScreen.tsx +0 -495
  35. package/template/src/screens/raffles/SetRaffleReminderScreen.tsx +0 -390
  36. package/template/src/screens/teams/JoinTeamScreen.tsx +0 -464
  37. package/template/src/screens/teams/MyTeamDetailsScreen.tsx +0 -979
  38. package/template/src/screens/teams/MyTeamScreen.tsx +0 -568
  39. package/template/src/screens/teams/PendingRequestsScreen.tsx +0 -426
  40. package/template/src/screens/volunteerOpportunities/SetReminderScreen.tsx +0 -631
  41. package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesDetailsScreen.tsx +0 -1049
  42. package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesScreen.tsx +0 -608
  43. package/template/src/utils/ClubSearchManager.ts +0 -222
@@ -1,426 +0,0 @@
1
- import React, { useState, useEffect, useCallback, useMemo } from "react";
2
- import {
3
- View,
4
- Text,
5
- StyleSheet,
6
- FlatList,
7
- StatusBar,
8
- Platform,
9
- TouchableOpacity,
10
- Image,
11
- ScrollView,
12
- RefreshControl,
13
- ActivityIndicator,
14
- Keyboard,
15
- } from "react-native";
16
- import { PendingRequestsScreenProps } from "../../types/navigation";
17
- import { Strings, theme } from "../../constants";
18
- import { moderateScale } from "../../utils/scaling";
19
- import { Fonts } from "../../constants/Fonts";
20
- import SVG from "../../assets/icons";
21
- import { SafeAreaView } from "react-native-safe-area-context";
22
- import { TeamCard } from "../../components/common";
23
- import ToastManager from "../../components/common/ToastManager";
24
- import { getApiErrorInfo, useGetImageUrl } from "../../services/authService";
25
- import { useInfinitePendingTeamRequests, PendingTeamRequest, useCancelRequestTeam } from "../../services/mainServices";
26
- import { useFocusEffect } from "@react-navigation/native";
27
-
28
- export const PendingRequestsScreen: React.FC<PendingRequestsScreenProps> = ({
29
- navigation,
30
- route,
31
- }) => {
32
- const { selectedClub } = route?.params ?? {};
33
- console.log("Selected member details in Pending screen--->", route?.params);
34
- const cancelRequestTeamMutation = useCancelRequestTeam();
35
- const [clubImage, setClubImage] = useState<string | null>(null);
36
-
37
- // Get member ID from route params or auth store
38
- const memberId = selectedClub?.selectedMember?.id || 0; // Replace with actual member ID from auth context
39
- const pageSize = 10;
40
-
41
- // Use infinite query for pending team requests
42
- const {
43
- data: pendingRequestsData,
44
- isLoading,
45
- isError,
46
- error,
47
- fetchNextPage,
48
- hasNextPage,
49
- isFetchingNextPage,
50
- refetch,
51
- } = useInfinitePendingTeamRequests(memberId, pageSize);
52
-
53
- // Flatten the paginated data into a single array
54
- const allPendingRequests = useMemo(() => {
55
- if (!pendingRequestsData?.pages) return [];
56
-
57
- return pendingRequestsData.pages.flatMap(page => page.data?.data || []);
58
- }, [pendingRequestsData]);
59
-
60
- // Handle API errors
61
- useEffect(() => {
62
- if (isError && error) {
63
- ToastManager.show({
64
- title: "Error",
65
- message: "Failed to load pending requests. Please try again.",
66
- type: "error",
67
- });
68
- }
69
- }, [isError, error]);
70
-
71
- useFocusEffect(useCallback(() => {
72
- refetch();
73
- }, [refetch]));
74
-
75
- // Load more data when reaching end of list
76
- const loadMoreData = useCallback(() => {
77
- if (hasNextPage && !isFetchingNextPage) {
78
- fetchNextPage();
79
- }
80
- }, [hasNextPage, isFetchingNextPage, fetchNextPage]);
81
-
82
- // Refresh data
83
- const onRefresh = useCallback(() => {
84
- refetch();
85
- }, [refetch]);
86
-
87
- const handleCancelRequest = (item:any) => {
88
-
89
- console.log("Cancel request for team:", item);
90
-
91
-
92
-
93
- const body = {
94
- clubId: item?.clubId,
95
- memberId: item?.memberId,
96
- teamId: item?.teamId
97
- }
98
- cancelRequestTeamMutation.mutate(body, {
99
- onSuccess: (response) => {
100
- ToastManager.success(response.data.message || 'Join club successful');
101
- navigation.goBack();
102
- },
103
- onError: (error) => {
104
- const errorInfo = getApiErrorInfo(error);
105
- ToastManager.error(errorInfo?.message);
106
-
107
- console.error('Join club failed:', error);
108
- },
109
- });
110
-
111
-
112
-
113
- // // TODO: Implement actual cancel request API call
114
- // // For now, just show success message
115
- // ToastManager.show({
116
- // title: "Success",
117
- // message: "Request cancelled successfully",
118
- // type: "success",
119
- // });
120
- };
121
-
122
- const renderClubCard = ({ item }: { item: PendingTeamRequest }) => {
123
- // Transform the data to match TeamCard props
124
- const teamData = {
125
- id: item.id,
126
- clubName: item.teamName,
127
- clubImageUrl: item.teamImageUrl || "",
128
- totalMembers: 0, // API doesn't provide member count for pending requests
129
- };
130
-
131
- return (
132
- <TeamCard
133
- team={item}
134
- onCancel={true}
135
- onCancelPress={() => handleCancelRequest(item)}
136
- />
137
- );
138
- };
139
-
140
- const renderFooter = () => {
141
- if (!isFetchingNextPage) return null;
142
-
143
- return (
144
- <View style={styles.footerLoader}>
145
- <ActivityIndicator size="small" color={theme.colors.blue} />
146
- <Text style={styles.footerLoaderText}>Loading more...</Text>
147
- </View>
148
- );
149
- };
150
-
151
- const renderEmptyComponent = () => {
152
- if (isLoading && !pendingRequestsData) {
153
- return (
154
- <View style={styles.loadingContainer}>
155
- <ActivityIndicator size="large" color={theme.colors.blue} />
156
- <Text style={styles.loadingText}>Loading pending requests...</Text>
157
- </View>
158
- );
159
- }
160
-
161
- return (
162
- <View style={styles.emptyContainer}>
163
- <Text style={styles.emptyText}>No pending requests</Text>
164
- </View>
165
- );
166
- };
167
-
168
-
169
- const handleScroll = useCallback(() => {
170
- Keyboard.dismiss();
171
- }, []);
172
-
173
- return (
174
- console.log("selectedClub--->", selectedClub),
175
-
176
- <View style={styles.container}>
177
- <StatusBar backgroundColor={theme.colors.blue} barStyle="light-content" />
178
- {Platform.OS === "android" && <View style={styles.statusBarBackground} />}
179
-
180
- <SafeAreaView style={styles.header}>
181
- <View style={styles.headerTopRow}>
182
- <TouchableOpacity onPress={() => navigation.goBack()}>
183
- <SVG.arrowLeft_white
184
- width={moderateScale(25)}
185
- height={moderateScale(25)}
186
- />
187
- </TouchableOpacity>
188
- <View style={{ flexDirection: "row" }}>
189
- <View style={styles.userConSty}>
190
- {!!selectedClub?.clubImage? (
191
- <Image
192
- // onLoadEnd={() => setIsLoading(false)}
193
- // onLoad={() => setIsLoading(true)}
194
- // onLoadStart={() => setIsLoading(true)}
195
- source={{ uri: selectedClub?.clubImage }}
196
- style={styles.userDetailsSty}
197
- />
198
- ) : (
199
- <View style={styles.placeholderLogoHeader}>
200
- <SVG.UsersIcon
201
- width={moderateScale(20)}
202
- height={moderateScale(20)}
203
- />
204
- </View>
205
- )}
206
- </View>
207
- <View style={styles.clubInfoContainer}>
208
- <Text style={styles.userNameSty}>
209
- {selectedClub?.clubName || "Unknown Member"}
210
- </Text>
211
- <Text style={styles.totalMembersSty}>
212
- {selectedClub?.totalMembers || 0}{" "}
213
- {(selectedClub?.totalMembers || 0) === 1 ? "member" : "members"}
214
- </Text>
215
- </View>
216
- </View>
217
- </View>
218
-
219
- </SafeAreaView>
220
- <View style={styles.contentList}>
221
- <Text style={styles.sectionHeading}>Pending Requests</Text>
222
- <FlatList
223
- data={allPendingRequests}
224
- renderItem={renderClubCard}
225
- keyExtractor={(item) => item.id.toString()}
226
- style={styles.clubsList}
227
- showsVerticalScrollIndicator={false}
228
- contentContainerStyle={styles.flatListContent}
229
- removeClippedSubviews={false}
230
- initialNumToRender={10}
231
- onEndReached={loadMoreData}
232
- onEndReachedThreshold={0.5}
233
- ListFooterComponent={renderFooter}
234
- ListEmptyComponent={renderEmptyComponent}
235
- onScroll={handleScroll}
236
- scrollEventThrottle={16}
237
- refreshControl={
238
- <RefreshControl
239
- refreshing={isLoading && !pendingRequestsData}
240
- onRefresh={onRefresh}
241
- colors={[theme.colors.primary]}
242
- tintColor={theme.colors.primary}
243
- />
244
- }
245
- />
246
- </View>
247
- </View>
248
- );
249
- };
250
-
251
- const styles = StyleSheet.create({
252
- container: {
253
- flex: 1,
254
- backgroundColor: theme.colors.blue,
255
- },
256
- statusBarBackground: {
257
- position: "absolute",
258
- top: 0,
259
- left: 0,
260
- right: 0,
261
- height: Platform.OS === "ios" ? 44 : 0,
262
- backgroundColor: theme.colors.blue,
263
- zIndex: 1000,
264
- },
265
- header: {
266
- backgroundColor: theme.colors.blue,
267
- paddingTop: Platform.OS === "android" ? theme.spacing.lg : theme.spacing.xs,
268
- },
269
- headerTopRow: {
270
- flexDirection: "row",
271
- alignItems: "center",
272
- paddingHorizontal: theme.spacing.lg,
273
- paddingBottom: theme.spacing.sm,
274
- },
275
- headerTitle: {
276
- fontFamily: Fonts.outfitMedium,
277
- fontSize: moderateScale(22),
278
- color: theme.colors.white,
279
- },
280
- clubInfoContainer: {
281
- marginLeft: moderateScale(4),
282
- justifyContent: 'center',
283
- },
284
- userNameSty: {
285
- color: theme.colors.white,
286
- fontFamily: Fonts.outfitRegular,
287
- fontSize: moderateScale(16),
288
- },
289
- totalMembersSty: {
290
- fontFamily: Fonts.outfitRegular,
291
- fontSize: moderateScale(11),
292
- color: theme.colors.appleGreen,
293
- },
294
- userDetailsSty: {
295
- width: moderateScale(36),
296
- height: moderateScale(36),
297
- borderRadius: moderateScale(18),
298
- },
299
- userConSty: {
300
- marginLeft: moderateScale(12),
301
- marginRight: theme.spacing.xs,
302
- width: moderateScale(36),
303
- height: moderateScale(36),
304
- borderRadius: moderateScale(20),
305
- borderWidth: 1.5,
306
- borderColor: theme.colors.imageBorder,
307
- backgroundColor: theme.colors.imageBorder,
308
- alignItems: "center",
309
- justifyContent: "center",
310
- },
311
- teamImage: {
312
- width: moderateScale(120),
313
- height: moderateScale(120),
314
- borderRadius: moderateScale(60),
315
- backgroundColor: theme.colors.background,
316
- },
317
- placeholderImage: {
318
- width: moderateScale(120),
319
- height: moderateScale(120),
320
- borderRadius: moderateScale(60),
321
- backgroundColor: theme.colors.border,
322
- justifyContent: "center",
323
- alignItems: "center",
324
- },
325
- userDefaultIcone: {
326
- width: moderateScale(30),
327
- height: moderateScale(30),
328
- borderRadius: moderateScale(10),
329
- },
330
- placeholderLogoHeader: {
331
- width: moderateScale(20),
332
- height: moderateScale(20),
333
- borderRadius: moderateScale(10),
334
- alignItems: "center",
335
- justifyContent: "center",
336
- },
337
- memberCount: {
338
- fontFamily: Fonts.outfitRegular,
339
- fontSize: moderateScale(11),
340
- color: theme.colors.appleGreen,
341
- marginLeft: theme.spacing.xs,
342
- },
343
- content: {
344
- flex: 1,
345
- backgroundColor: theme.colors.background,
346
- borderTopLeftRadius: moderateScale(30),
347
- borderTopRightRadius: moderateScale(30),
348
- marginTop: -theme.spacing.xl,
349
- },
350
- sectionContainer: {
351
- paddingHorizontal: theme.spacing.lg,
352
- paddingTop: theme.spacing.lg,
353
- },
354
- sectionHeading: {
355
- fontFamily: Fonts.outfitSemiBold,
356
- fontSize: moderateScale(18),
357
- color: theme.colors.black,
358
- marginBottom: theme.spacing.md,
359
- },
360
- clubCardWrapper: {
361
- flex: 1,
362
- marginRight: theme.spacing.sm,
363
- },
364
- cancelButton: {
365
- backgroundColor: "#FF4444",
366
- borderRadius: theme.borderRadius.md,
367
- paddingHorizontal: theme.spacing.md,
368
- paddingVertical: theme.spacing.sm,
369
- },
370
- cancelButtonText: {
371
- fontFamily: Fonts.outfitMedium,
372
- fontSize: moderateScale(12),
373
- color: theme.colors.white,
374
- },
375
- emptyContainer: {
376
- alignItems: "center",
377
- paddingVertical: theme.spacing.xl,
378
- },
379
- emptyText: {
380
- fontFamily: Fonts.outfitRegular,
381
- fontSize: moderateScale(14),
382
- color: theme.colors.textSecondary,
383
- },
384
- footerLoader: {
385
- paddingVertical: theme.spacing.md,
386
- alignItems: "center",
387
- },
388
- footerLoaderText: {
389
- fontFamily: Fonts.outfitRegular,
390
- fontSize: moderateScale(12),
391
- color: theme.colors.textSecondary,
392
- marginTop: theme.spacing.xs,
393
- },
394
- loadingContainer: {
395
- alignItems: "center",
396
- paddingVertical: theme.spacing.xl,
397
- },
398
- loadingText: {
399
- fontFamily: Fonts.outfitRegular,
400
- fontSize: moderateScale(14),
401
- color: theme.colors.textSecondary,
402
- marginTop: theme.spacing.md,
403
- },
404
- sectionTitle: {
405
- fontFamily: Fonts.outfitMedium,
406
- fontSize: theme.typography.fontSize.xs,
407
- color: theme.colors.blue,
408
- marginBottom: theme.spacing.md,
409
- letterSpacing: 0.5,
410
- },
411
- clubsList: {
412
- flex: 1,
413
- },
414
- flatListContent: {
415
- paddingBottom: theme.spacing.xl,
416
- },
417
- contentList: {
418
- flex: 1,
419
- backgroundColor: theme.colors.background,
420
- borderTopLeftRadius: moderateScale(30),
421
- borderTopRightRadius: moderateScale(30),
422
- marginTop: -theme.spacing.xl,
423
- paddingHorizontal: theme.spacing.lg,
424
- paddingTop: theme.spacing.lg,
425
- },
426
- });