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,543 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { View, Text, StyleSheet, Modal, TouchableOpacity, Alert, Keyboard } from 'react-native';
3
+ import { Button } from './Button';
4
+ import { TextInput } from './TextInput';
5
+ import { ImagePickerComponent } from './ImagePicker';
6
+ import { theme } from '../../constants';
7
+ import { Strings } from '../../constants/strings';
8
+ import { moderateScale } from '../../utils/scaling';
9
+ import { Fonts } from '../../constants/Fonts';
10
+ import SVG from '../../assets/icons';
11
+ import { ImagePickerResult, pickImage } from '../../utils/imagePicker';
12
+ import DatePicker from 'react-native-date-picker';
13
+ import { Validation } from '../../utils/validation';
14
+ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
15
+ import ToastManager from './ToastManager';
16
+ import { UploadState, useImageUpload } from '../../hooks/useImageUpload';
17
+
18
+
19
+ interface AddMemberModalProps {
20
+ visible: boolean;
21
+ onClose: () => void;
22
+ onSave: (memberData: any) => void;
23
+ onSuccessClose: boolean;
24
+ }
25
+
26
+ export const AddMemberModal: React.FC<AddMemberModalProps> = ({
27
+ visible,
28
+ onClose,
29
+ onSave,
30
+ onSuccessClose,
31
+ }) => {
32
+ const [memberName, setMemberName] = useState('');
33
+ const [dateOfBirth, setDateOfBirth] = useState<Date | null>(null);
34
+ const [relationshipType, setRelationshipType] = useState('');
35
+ const [showDatePicker, setShowDatePicker] = useState(false);
36
+ const [profileImage, setProfileImage] = useState<ImagePickerResult | null>(null);
37
+ const [imageUploadState, resetImageUploadState] = useState<UploadState>({
38
+ isUploading: false,
39
+ progress: 0,
40
+ error: null,
41
+ uploadedUrl: null,
42
+ isRetrying: false,
43
+ retryCount: 0,
44
+ });
45
+
46
+ // Error states for validation
47
+ const [errors, setErrors] = useState({
48
+ name: '',
49
+ dateOfBirth: '',
50
+ relationshipType: ''
51
+ });
52
+
53
+ useEffect(() => {
54
+ if (onSuccessClose) {
55
+ onClose();
56
+ handleClose();
57
+ }
58
+ }, [onSuccessClose]);
59
+
60
+
61
+
62
+
63
+ const {
64
+ uploadState,
65
+ uploadImage,
66
+ } = useImageUpload({
67
+ containerName: 'user',
68
+ maxRetries: 3,
69
+ retryDelay: 1000,
70
+ onUploadStart: () => {
71
+
72
+ console.log('Upload started');
73
+ },
74
+ onUploadProgress: (progress) => {
75
+ resetImageUploadState(prev => ({ ...prev, progress }));
76
+ console.log(`Upload progress: ${progress}%`);
77
+ },
78
+ onUploadSuccess: (url) => {
79
+ resetImageUploadState(prev => ({ ...prev, uploadedUrl: url }));
80
+ console.log('Upload successful:', url);
81
+ // ToastManager.success('Success', 'Image uploaded successfully');
82
+ },
83
+ onUploadError: (error) => {
84
+ resetImageUploadState(prev => ({ ...prev, error }));
85
+ console.error('Upload error:', error);
86
+ ToastManager.error('Upload Failed', error);
87
+ },
88
+ onUploadComplete: () => {
89
+ resetImageUploadState(prev => ({ ...prev, progress: 0 }));
90
+ console.log('Upload completed');
91
+ },
92
+ });
93
+
94
+ const handleImagePicker = async (result: ImagePickerResult) => {
95
+ try {
96
+ console.log("result===???", result);
97
+ if (result && result.uri) {
98
+ setProfileImage(result);
99
+ const uploadResult = await uploadImage(result);
100
+ if (uploadResult.success) {
101
+ console.log('Image uploaded successfully:', uploadResult);
102
+ } else {
103
+ console.error('Image upload failed:', uploadResult.error);
104
+ }
105
+
106
+ }
107
+ } catch (error) {
108
+ console.error('Error handling image:', error);
109
+ Alert.alert('Error', 'Failed to handle image');
110
+ }
111
+ };
112
+
113
+ const handleDateChange = (selectedDate: Date) => {
114
+ setDateOfBirth(selectedDate);
115
+ // Validate date when user selects a new date
116
+ if (errors.dateOfBirth) {
117
+ validateDateOfBirth(selectedDate);
118
+ }
119
+ };
120
+
121
+ const formatDate = (date: Date | null) => {
122
+ if (!date) {
123
+ return Strings.AUTH.DATE_OF_BIRTH_PLACEHOLDER;
124
+ }
125
+ return date.toLocaleDateString('en-GB', {
126
+ day: '2-digit',
127
+ month: '2-digit',
128
+ year: 'numeric',
129
+ });
130
+ };
131
+
132
+ // Validation functions
133
+ const validateName = (name: string) => {
134
+ if (!Validation.validateRequired(name)) {
135
+ setErrors(prev => ({ ...prev, name: 'Member name is required' }));
136
+ return false;
137
+ } else if (!Validation.validateMemberName(name)) {
138
+ setErrors(prev => ({ ...prev, name: 'Name must be 2-30 characters long and contain only letters and spaces' }));
139
+ return false;
140
+ } else {
141
+ setErrors(prev => ({ ...prev, name: '' }));
142
+ return true;
143
+ }
144
+ };
145
+
146
+ const validateDateOfBirth = (date: Date | null) => {
147
+ if (!date) {
148
+ setErrors(prev => ({ ...prev, dateOfBirth: 'Date of birth is required' }));
149
+ return false;
150
+ } else {
151
+ setErrors(prev => ({ ...prev, dateOfBirth: '' }));
152
+ return true;
153
+ }
154
+ };
155
+
156
+ const validateRelationshipType = (relationship: string) => {
157
+ if (!Validation.validateRequired(relationship)) {
158
+ setErrors(prev => ({ ...prev, relationshipType: 'Relationship type is required' }));
159
+ return false;
160
+ // } else if (!Validation.validateRelationshipType(relationship)) {
161
+ // setErrors(prev => ({ ...prev, relationshipType: 'Please select a valid relationship type' }));
162
+ // return false;
163
+
164
+ } else if (relationship.length < 3) {
165
+ setErrors(prev => ({ ...prev, relationshipType: 'Please type a minimum of 3 characters' }));
166
+ return false;
167
+
168
+ } else {
169
+ setErrors(prev => ({ ...prev, relationshipType: '' }));
170
+ return true;
171
+ }
172
+ };
173
+
174
+ // Handle input changes with validation
175
+ const handleNameChange = (text: string) => {
176
+ setMemberName(text);
177
+ if (errors.name) {
178
+ validateName(text);
179
+ }
180
+ };
181
+
182
+ const handleRelationshipChange = (text: string) => {
183
+ setRelationshipType(text);
184
+ if (errors.relationshipType) {
185
+ validateRelationshipType(text);
186
+ }
187
+ };
188
+
189
+ const handleSave = () => {
190
+ // Validate all fields
191
+ const isNameValid = validateName(memberName);
192
+ const isDateValid = validateDateOfBirth(dateOfBirth);
193
+ const isRelationshipValid = validateRelationshipType(relationshipType);
194
+
195
+ // If any validation fails, don't proceed
196
+ if (!isNameValid || !isDateValid || !isRelationshipValid) {
197
+ return;
198
+ }
199
+
200
+ const memberData = {
201
+ name: memberName.trim(),
202
+ dateOfBirth: formatDate(dateOfBirth),
203
+ relationshipType: relationshipType.trim(),
204
+ profileImage: profileImage,
205
+ };
206
+
207
+ onSave(memberData);
208
+ };
209
+
210
+ const handleClose = () => {
211
+ setMemberName('');
212
+ setDateOfBirth(null);
213
+ setRelationshipType('');
214
+ setProfileImage(null);
215
+ setErrors({
216
+ name: '',
217
+ dateOfBirth: '',
218
+ relationshipType: ''
219
+ });
220
+ onClose();
221
+ };
222
+
223
+
224
+ const handleImageError = (error: string) => {
225
+ ToastManager.error('Error', error);
226
+ };
227
+
228
+ return (
229
+ <Modal
230
+ visible={visible}
231
+ animationType="slide"
232
+ transparent={true}
233
+ onRequestClose={handleClose}
234
+ >
235
+ <TouchableOpacity
236
+ style={styles.modalOverlay}
237
+ activeOpacity={1}
238
+ onPress={handleClose}
239
+ >
240
+ <TouchableOpacity
241
+ style={styles.modalContainer}
242
+ activeOpacity={1}
243
+ onPress={(e) => {
244
+ e.stopPropagation();
245
+ Keyboard.dismiss();
246
+ }}
247
+ >
248
+ <KeyboardAwareScrollView
249
+ style={styles.scrollView}
250
+ contentContainerStyle={styles.scrollContent}
251
+ showsVerticalScrollIndicator={false}
252
+ keyboardShouldPersistTaps="handled"
253
+ enableOnAndroid={true}
254
+ enableAutomaticScroll={true}
255
+ extraScrollHeight={120}
256
+ keyboardOpeningTime={250}
257
+ >
258
+ {/* Drag Handle */}
259
+ <View style={styles.dragHandle} />
260
+
261
+ {/* Profile Photo Upload */}
262
+ <View style={styles.photoSection}>
263
+ <ImagePickerComponent
264
+ progress={imageUploadState?.progress}
265
+ loading={uploadState.isUploading}
266
+ defaultIcon={SVG.uploadImageMember}
267
+ onImageSelected={handleImagePicker}
268
+ onError={handleImageError}
269
+ imageUri={profileImage?.uri}
270
+ options={{
271
+ allowsEditing: true,
272
+ aspect: [1, 1],
273
+ quality: 0.8,
274
+ }}
275
+ style={styles.photoContainer}
276
+ />
277
+ </View>
278
+
279
+ {/* Form Fields */}
280
+ <View style={styles.formSection}>
281
+ <View style={styles.inputContainer}>
282
+ <TextInput
283
+ label={Strings.AUTH.MEMBER_NAME}
284
+ value={memberName}
285
+ onChangeText={handleNameChange}
286
+ placeholder={Strings.AUTH.MEMBER_NAME_PLACEHOLDER}
287
+ keyboardType="default"
288
+ autoCapitalize="words"
289
+ autoCorrect={false}
290
+ variant="outlined"
291
+ error={errors.name}
292
+ maxLength={30}
293
+ />
294
+ </View>
295
+
296
+ <View style={styles.inputContainer}>
297
+ <Text style={styles.inputLabel}>{Strings.AUTH.DATE_OF_BIRTH}</Text>
298
+ <TouchableOpacity
299
+ onPress={() => setShowDatePicker(true)}
300
+ style={[
301
+ styles.dateInput,
302
+ errors.dateOfBirth && styles.errorInput
303
+ ]}
304
+ >
305
+ <Text style={[
306
+ styles.dateText,
307
+ !dateOfBirth && styles.placeholderText
308
+ ]}>
309
+ {formatDate(dateOfBirth)}
310
+ </Text>
311
+ <SVG.chevronRight width={moderateScale(16)} height={moderateScale(16)} />
312
+ </TouchableOpacity>
313
+ {errors.dateOfBirth ? (
314
+ <Text style={styles.errorText}>{errors.dateOfBirth}</Text>
315
+ ) : null}
316
+ </View>
317
+
318
+ <View style={styles.inputContainer}>
319
+ <TextInput
320
+ label={Strings.AUTH.TYPE_OF_RELATIONSHIP}
321
+ value={relationshipType}
322
+ onChangeText={handleRelationshipChange}
323
+ placeholder={Strings.AUTH.TYPE_OF_RELATIONSHIP_PLACEHOLDER}
324
+ keyboardType="default"
325
+ autoCapitalize="words"
326
+ autoCorrect={false}
327
+ variant="outlined"
328
+ error={errors.relationshipType}
329
+ maxLength={15}
330
+ />
331
+ </View>
332
+ </View>
333
+
334
+ {/* Save Button */}
335
+ <View style={styles.buttonContainer}>
336
+ <Button
337
+ title={Strings.AUTH.SAVE}
338
+ onPress={handleSave}
339
+ variant="primary"
340
+ size="medium"
341
+ style={styles.saveButton}
342
+ />
343
+ </View>
344
+ </KeyboardAwareScrollView>
345
+ </TouchableOpacity>
346
+ </TouchableOpacity>
347
+
348
+ {/* Date Picker */}
349
+ <DatePicker
350
+ modal
351
+ open={showDatePicker}
352
+ date={dateOfBirth || new Date()}
353
+ mode="date"
354
+ maximumDate={new Date()}
355
+ onConfirm={(date) => {
356
+ setShowDatePicker(false);
357
+ handleDateChange(date);
358
+ }}
359
+ onCancel={() => {
360
+ setShowDatePicker(false);
361
+ }}
362
+ title="Select Date of Birth"
363
+ confirmText="Confirm"
364
+ cancelText="Cancel"
365
+ />
366
+ </Modal>
367
+ );
368
+ };
369
+
370
+ const styles = StyleSheet.create({
371
+ modalOverlay: {
372
+ flex: 1,
373
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
374
+ justifyContent: 'flex-end',
375
+ },
376
+ keyboardAvoidingView: {
377
+ flex: 1,
378
+ justifyContent: 'flex-end',
379
+ },
380
+ modalContainer: {
381
+ backgroundColor: theme.colors.white,
382
+ borderTopLeftRadius: moderateScale(20),
383
+ borderTopRightRadius: moderateScale(20),
384
+ paddingHorizontal: theme.spacing.lg,
385
+ paddingTop: theme.spacing.md,
386
+ paddingBottom: theme.spacing.xl,
387
+ maxHeight: '90%',
388
+ minHeight: '75%',
389
+ shadowColor: '#000',
390
+ shadowOffset: {
391
+ width: 0,
392
+ height: -2,
393
+ },
394
+ shadowOpacity: 0.25,
395
+ shadowRadius: 3.84,
396
+ elevation: 5,
397
+ },
398
+ scrollView: {
399
+ flex: 1,
400
+ },
401
+ scrollContent: {
402
+ flexGrow: 1,
403
+ paddingBottom: theme.spacing.xs,
404
+ },
405
+ header: {
406
+ flexDirection: 'row',
407
+ justifyContent: 'space-between',
408
+ alignItems: 'center',
409
+ paddingHorizontal: theme.spacing.lg,
410
+ paddingVertical: theme.spacing.md,
411
+ borderBottomWidth: 1,
412
+ borderBottomColor: theme.colors.border,
413
+ },
414
+ closeButton: {
415
+ paddingHorizontal: theme.spacing.sm,
416
+ paddingVertical: theme.spacing.xs,
417
+ },
418
+ closeButtonText: {
419
+ fontFamily: Fonts.outfitRegular,
420
+ fontSize: theme.typography.fontSize.md,
421
+ color: theme.colors.blue,
422
+ },
423
+ headerTitle: {
424
+ fontFamily: Fonts.outfitSemiBold,
425
+ fontSize: moderateScale(18),
426
+ color: theme.colors.text,
427
+ },
428
+ placeholder: {
429
+ width: moderateScale(60),
430
+ },
431
+ dragHandle: {
432
+ width: moderateScale(40),
433
+ height: moderateScale(4),
434
+ backgroundColor: '#D1D5DB',
435
+ borderRadius: moderateScale(2),
436
+ alignSelf: 'center',
437
+ marginBottom: theme.spacing.lg,
438
+ },
439
+ content: {
440
+ flex: 1,
441
+ paddingHorizontal: theme.spacing.lg,
442
+ paddingBottom: theme.spacing.lg,
443
+ },
444
+ photoSection: {
445
+ alignItems: 'center',
446
+ },
447
+ photoContainer: {
448
+ },
449
+ profileImage: {
450
+ width: moderateScale(100),
451
+ height: moderateScale(100),
452
+ borderRadius: moderateScale(50),
453
+ backgroundColor: theme.colors.surface,
454
+ },
455
+ photoPlaceholder: {
456
+ width: moderateScale(100),
457
+ height: moderateScale(100),
458
+ borderRadius: moderateScale(50),
459
+ backgroundColor: '#F3F4F6',
460
+ justifyContent: 'center',
461
+ alignItems: 'center',
462
+ borderWidth: 2,
463
+ borderColor: '#E5E7EB',
464
+ borderStyle: 'solid',
465
+ },
466
+ photoText: {
467
+ fontFamily: Fonts.outfitRegular,
468
+ fontSize: theme.typography.fontSize.sm,
469
+ color: '#9CA3AF',
470
+ textAlign: 'center',
471
+ },
472
+ formSection: {
473
+ marginBottom: theme.spacing.xs,
474
+ },
475
+ inputContainer: {
476
+ marginVertical: theme.spacing.xs,
477
+ },
478
+ inputLabel: {
479
+ fontFamily: Fonts.outfitMedium,
480
+ fontSize: theme.typography.fontSize.sm,
481
+ color: '#374151',
482
+ marginBottom: theme.spacing.xs,
483
+ },
484
+ input: {
485
+ borderWidth: 1,
486
+ borderColor: theme.colors.border,
487
+ borderRadius: moderateScale(8),
488
+ paddingHorizontal: theme.spacing.md,
489
+ paddingVertical: theme.spacing.sm,
490
+ backgroundColor: theme.colors.white,
491
+ fontFamily: Fonts.outfitRegular,
492
+ fontSize: theme.typography.fontSize.md,
493
+ color: theme.colors.text,
494
+ },
495
+ dateInput: {
496
+ flexDirection: 'row',
497
+ justifyContent: 'space-between',
498
+ alignItems: 'center',
499
+ borderWidth: 1,
500
+ borderColor: theme.colors.border,
501
+ borderRadius: moderateScale(30),
502
+ paddingHorizontal: theme.spacing.md,
503
+ paddingVertical: theme.spacing.sm,
504
+ backgroundColor: theme.colors.white,
505
+ minHeight: moderateScale(50),
506
+ },
507
+ dateText: {
508
+ fontFamily: Fonts.outfitRegular,
509
+ fontSize: theme.typography.fontSize.md,
510
+ color: theme.colors.text,
511
+ },
512
+ placeholderText: {
513
+ color: '#9CA3AF',
514
+ },
515
+ bottomContainer: {
516
+ paddingHorizontal: theme.spacing.lg,
517
+ paddingVertical: theme.spacing.lg,
518
+ backgroundColor: theme.colors.background,
519
+ borderTopWidth: 1,
520
+ borderTopColor: theme.colors.border,
521
+ },
522
+ buttonContainer: {
523
+ marginTop: theme.spacing.md,
524
+ paddingBottom: theme.spacing.lg,
525
+ },
526
+ saveButton: {
527
+ width: '100%',
528
+ backgroundColor: theme.colors.blue,
529
+ paddingVertical: theme.spacing.md,
530
+ },
531
+ errorText: {
532
+ fontFamily: Fonts.outfitRegular,
533
+ fontSize: theme.typography.fontSize.sm,
534
+ color: theme.colors.error,
535
+ marginTop: theme.spacing.xs,
536
+ marginLeft: theme.spacing.xs,
537
+
538
+ },
539
+ errorInput: {
540
+ borderColor: theme.colors.error,
541
+ borderWidth: 2
542
+ },
543
+ });
@@ -0,0 +1,91 @@
1
+ import React from "react";
2
+ import { ActivityIndicator, StyleSheet, View, TouchableWithoutFeedback } from "react-native";
3
+ import { moderateScale } from "../../utils/scaling";
4
+ import { theme } from "../../constants";
5
+
6
+ export const loaderRef: any = React.createRef();
7
+ export function showLoader() {
8
+ let ref: any = loaderRef.current;
9
+ if (ref) {
10
+ ref.showLoader();
11
+ }
12
+ }
13
+ export function hideLoader() {
14
+ let ref: any = loaderRef.current;
15
+ if (ref) {
16
+ ref.hideLoader();
17
+ }
18
+ }
19
+ interface AppLoaderState {
20
+ loader: boolean;
21
+ }
22
+
23
+ class AppLoader extends React.Component<{}, AppLoaderState> {
24
+ constructor(props: any) {
25
+ super(props);
26
+ this.state = {
27
+ loader: false,
28
+ };
29
+ }
30
+
31
+ showLoader() {
32
+ this.setState({
33
+ loader: true,
34
+ });
35
+ }
36
+
37
+ hideLoader() {
38
+ setTimeout(() => {
39
+ this.setState({
40
+ loader: false,
41
+ });
42
+ }, 300);
43
+ }
44
+
45
+ render() {
46
+ return (
47
+ this.state.loader && (
48
+ <View style={[styles.container, { height: "100%", width: "100%" }]}>
49
+ <TouchableWithoutFeedback>
50
+ <View
51
+ style={{
52
+ height: moderateScale(100),
53
+ width: moderateScale(100),
54
+ justifyContent: "center",
55
+ alignItems: "center",
56
+ backgroundColor: "white",
57
+ borderRadius: moderateScale(10),
58
+ shadowColor: "#000",
59
+ shadowOffset: {
60
+ width: 0,
61
+ height: 2,
62
+ },
63
+ shadowOpacity: 0.25,
64
+ shadowRadius: 3.84,
65
+ elevation: 5,
66
+ }}
67
+ >
68
+ <ActivityIndicator size="large" color={theme.colors.appleGreen} />
69
+ </View>
70
+ </TouchableWithoutFeedback>
71
+ </View>
72
+ )
73
+ );
74
+ }
75
+ }
76
+
77
+ export default AppLoader;
78
+
79
+ const styles = StyleSheet.create({
80
+ container: {
81
+ justifyContent: "center",
82
+ alignItems: "center",
83
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
84
+ position: "absolute",
85
+ top: 0,
86
+ left: 0,
87
+ right: 0,
88
+ bottom: 0,
89
+ zIndex: 9999,
90
+ },
91
+ });