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.
- package/lib/createApp.js +7 -2
- package/package.json +1 -1
- package/template/App.tsx +118 -0
- package/template/ReactotronConfig.js +5 -0
- package/template/android/app/build.gradle +184 -0
- package/template/android/app/debug.keystore +0 -0
- package/template/android/app/google-services.json +29 -0
- package/template/android/app/proguard-rules.pro +14 -0
- package/template/android/app/src/debug/AndroidManifest.xml +7 -0
- package/template/android/app/src/debugOptimized/AndroidManifest.xml +7 -0
- package/template/android/app/src/main/AndroidManifest.xml +28 -0
- package/template/android/app/src/main/assets/fonts/Outfit-Bold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Outfit-Light.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Outfit-Medium.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Outfit-Regular.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Outfit-SemiBold.ttf +0 -0
- package/template/android/app/src/main/java/com/club/yakka/MainActivity.kt +61 -0
- package/template/android/app/src/main/java/com/club/yakka/MainApplication.kt +60 -0
- package/template/android/app/src/main/res/drawable/ic_launcher_background.xml +6 -0
- package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/template/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png +0 -0
- package/template/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png +0 -0
- package/template/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png +0 -0
- package/template/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png +0 -0
- package/template/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png +0 -0
- package/template/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/template/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp +0 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/template/android/app/src/main/res/values/colors.xml +6 -0
- package/template/android/app/src/main/res/values/strings.xml +5 -0
- package/template/android/app/src/main/res/values/styles.xml +14 -0
- package/template/android/app/src/main/res/values-night/colors.xml +1 -0
- package/template/android/build.gradle +33 -0
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/template/android/gradle.properties +65 -0
- package/template/android/gradlew +251 -0
- package/template/android/gradlew.bat +94 -0
- package/template/android/settings.gradle +39 -0
- package/template/app.json +69 -0
- package/template/assets/adaptive-icon.png +0 -0
- package/template/assets/adaptive-icon1.png +0 -0
- package/template/assets/app_icon.png +0 -0
- package/template/assets/favicon.png +0 -0
- package/template/assets/icon.png +0 -0
- package/template/assets/splash-icon.png +0 -0
- package/template/babel-plugin-disable-font-scaling.js +41 -0
- package/template/babel.config.js +28 -0
- package/template/firebase.json +5 -0
- package/template/index.ts +24 -0
- package/template/ios/.xcode.env +11 -0
- package/template/ios/ClubYakka/AppDelegate.swift +74 -0
- package/template/ios/ClubYakka/ClubYakka-Bridging-Header.h +3 -0
- package/template/ios/ClubYakka/ClubYakka.entitlements +8 -0
- package/template/ios/ClubYakka/GoogleService-Info.plist +30 -0
- package/template/ios/ClubYakka/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
- package/template/ios/ClubYakka/Images.xcassets/AppIcon.appiconset/Contents.json +14 -0
- package/template/ios/ClubYakka/Images.xcassets/Contents.json +6 -0
- package/template/ios/ClubYakka/Images.xcassets/SplashScreenBackground.colorset/Contents.json +20 -0
- package/template/ios/ClubYakka/Images.xcassets/SplashScreenLegacy.imageset/Contents.json +23 -0
- package/template/ios/ClubYakka/Images.xcassets/SplashScreenLegacy.imageset/image.png +0 -0
- package/template/ios/ClubYakka/Images.xcassets/SplashScreenLegacy.imageset/image@2x.png +0 -0
- package/template/ios/ClubYakka/Images.xcassets/SplashScreenLegacy.imageset/image@3x.png +0 -0
- package/template/ios/ClubYakka/Info.plist +101 -0
- package/template/ios/ClubYakka/PrivacyInfo.xcprivacy +50 -0
- package/template/ios/ClubYakka/SplashScreen.storyboard +48 -0
- package/template/ios/ClubYakka/Supporting/Expo.plist +12 -0
- package/template/ios/ClubYakka.xcodeproj/project.pbxproj +669 -0
- package/template/ios/ClubYakka.xcodeproj/xcshareddata/xcschemes/ClubYakka.xcscheme +88 -0
- package/template/ios/ClubYakka.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/ClubYakka.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
- package/template/ios/Podfile +84 -0
- package/template/ios/Podfile.lock +2698 -0
- package/template/ios/Podfile.properties.json +8 -0
- package/template/metro.config.js +17 -0
- package/template/package.json +70 -0
- package/template/patches/react-native-background-upload+6.6.0.patch +704 -0
- package/template/react-native.config.js +7 -0
- package/template/src/assets/fonts/Outfit-Bold.ttf +0 -0
- package/template/src/assets/fonts/Outfit-Light.ttf +0 -0
- package/template/src/assets/fonts/Outfit-Medium.ttf +0 -0
- package/template/src/assets/fonts/Outfit-Regular.ttf +0 -0
- package/template/src/assets/fonts/Outfit-SemiBold.ttf +0 -0
- package/template/src/assets/icons/BG.svg +33 -0
- package/template/src/assets/icons/Ic_Users.svg +6 -0
- package/template/src/assets/icons/arrow-left-white.svg +4 -0
- package/template/src/assets/icons/arrow-left.svg +4 -0
- package/template/src/assets/icons/bell.svg +4 -0
- package/template/src/assets/icons/bottomSheetIcone.svg +3 -0
- package/template/src/assets/icons/call.svg +4 -0
- package/template/src/assets/icons/camera.svg +0 -0
- package/template/src/assets/icons/chatAppleGreenBG.svg +22 -0
- package/template/src/assets/icons/check.svg +4 -0
- package/template/src/assets/icons/check_Radio.svg +4 -0
- package/template/src/assets/icons/chevron-right.svg +3 -0
- package/template/src/assets/icons/clubDefauldImage.png +0 -0
- package/template/src/assets/icons/curvBackgroundView.svg +3 -0
- package/template/src/assets/icons/defaultClub.png +0 -0
- package/template/src/assets/icons/email.svg +3 -0
- package/template/src/assets/icons/emptyUser.svg +5 -0
- package/template/src/assets/icons/eye-Hide.svg +8 -0
- package/template/src/assets/icons/eye.svg +4 -0
- package/template/src/assets/icons/gallery.svg +4 -0
- package/template/src/assets/icons/home.svg +4 -0
- package/template/src/assets/icons/ic_Calendar.svg +14 -0
- package/template/src/assets/icons/ic_Calendar_blue.svg +12 -0
- package/template/src/assets/icons/ic_Calendar_white.svg +12 -0
- package/template/src/assets/icons/ic_Chat.svg +14 -0
- package/template/src/assets/icons/ic_ChatAppleGreen.svg +21 -0
- package/template/src/assets/icons/ic_ChatAppleWhite.svg +21 -0
- package/template/src/assets/icons/ic_Download.svg +6 -0
- package/template/src/assets/icons/ic_Events.svg +6 -0
- package/template/src/assets/icons/ic_HeadCoachIcon.svg +3 -0
- package/template/src/assets/icons/ic_Membership.svg +10 -0
- package/template/src/assets/icons/ic_Notification.svg +6 -0
- package/template/src/assets/icons/ic_Raffles.svg +14 -0
- package/template/src/assets/icons/ic_Referral_Members.svg +12 -0
- package/template/src/assets/icons/ic_Shop.svg +13 -0
- package/template/src/assets/icons/ic_Teams.svg +8 -0
- package/template/src/assets/icons/ic_Volunteer.svg +9 -0
- package/template/src/assets/icons/ic_add.svg +3 -0
- package/template/src/assets/icons/ic_addCircle.svg +5 -0
- package/template/src/assets/icons/ic_chatSend.svg +4 -0
- package/template/src/assets/icons/ic_chat_blue_bg.svg +22 -0
- package/template/src/assets/icons/ic_clock_blue.svg +4 -0
- package/template/src/assets/icons/ic_delete.svg +8 -0
- package/template/src/assets/icons/ic_more.svg +5 -0
- package/template/src/assets/icons/ic_mute.svg +10 -0
- package/template/src/assets/icons/ic_pdf.svg +3 -0
- package/template/src/assets/icons/ic_pending_AppleGreen.svg +11 -0
- package/template/src/assets/icons/ic_right_appleGreen.svg +11 -0
- package/template/src/assets/icons/ic_unread_chat_blue_bg.svg +23 -0
- package/template/src/assets/icons/ic_volunteer_Member.svg +8 -0
- package/template/src/assets/icons/index.ts +144 -0
- package/template/src/assets/icons/location-blue.svg +4 -0
- package/template/src/assets/icons/location-white.svg +4 -0
- package/template/src/assets/icons/location.svg +4 -0
- package/template/src/assets/icons/lock.svg +5 -0
- package/template/src/assets/icons/log-out.svg +5 -0
- package/template/src/assets/icons/login_logo.svg +9 -0
- package/template/src/assets/icons/mail.svg +4 -0
- package/template/src/assets/icons/or_saprater.svg +5 -0
- package/template/src/assets/icons/password.svg +4 -0
- package/template/src/assets/icons/profile-appleGreen.svg +6 -0
- package/template/src/assets/icons/search.svg +3 -0
- package/template/src/assets/icons/settings.svg +4 -0
- package/template/src/assets/icons/success.svg +4 -0
- package/template/src/assets/icons/unCheck_Radio.svg +3 -0
- package/template/src/assets/icons/uncheck.svg +3 -0
- package/template/src/assets/icons/upload_Image.svg +6 -0
- package/template/src/assets/icons/upload_Image_Member.svg +6 -0
- package/template/src/assets/icons/user.svg +4 -0
- package/template/src/assets/icons/wifi.svg +1 -0
- package/template/src/assets/images/Splash.png +0 -0
- package/template/src/assets/images/SplashLogo.png +0 -0
- package/template/src/assets/images/background.png +0 -0
- package/template/src/assets/images/clubDefauldImage.png +0 -0
- package/template/src/assets/images/index.tsx +9 -0
- package/template/src/assets/index.ts +1 -0
- package/template/src/components/common/AddMemberModal.tsx +543 -0
- package/template/src/components/common/AppLoader.tsx +91 -0
- package/template/src/components/common/Button.tsx +173 -0
- package/template/src/components/common/ClubCard.tsx +248 -0
- package/template/src/components/common/Icon.tsx +93 -0
- package/template/src/components/common/IconAlt.tsx +65 -0
- package/template/src/components/common/IconButton.tsx +92 -0
- package/template/src/components/common/ImagePicker.tsx +451 -0
- package/template/src/components/common/LoadingSpinner.tsx +30 -0
- package/template/src/components/common/OTPInput.tsx +128 -0
- package/template/src/components/common/ReminderCalendar.tsx +129 -0
- package/template/src/components/common/ReminderCardItem.tsx +91 -0
- package/template/src/components/common/SafeAreaWrapper.tsx +27 -0
- package/template/src/components/common/SetReminderModal.tsx +308 -0
- package/template/src/components/common/SlowInternet.js +57 -0
- package/template/src/components/common/TeamCard.tsx +297 -0
- package/template/src/components/common/TextInput.tsx +227 -0
- package/template/src/components/common/ToastConfig.tsx +103 -0
- package/template/src/components/common/ToastManager.ts +86 -0
- package/template/src/components/common/UploadProgressModal.tsx +284 -0
- package/template/src/components/common/WrapperContainer.tsx +39 -0
- package/template/src/components/common/index.ts +19 -0
- package/template/src/constants/Constants.tsx +7 -0
- package/template/src/constants/Fonts.tsx +30 -0
- package/template/src/constants/index.ts +45 -0
- package/template/src/constants/strings.ts +211 -0
- package/template/src/constants/theme.ts +72 -0
- package/template/src/contexts/AuthContext.tsx +268 -0
- package/template/src/contexts/index.ts +2 -0
- package/template/src/hooks/index.ts +3 -0
- package/template/src/hooks/useImageUpload.ts +199 -0
- package/template/src/index.ts +8 -0
- package/template/src/navigation/AuthStack.tsx +67 -0
- package/template/src/navigation/MainStack.tsx +183 -0
- package/template/src/navigation/MiddleStack.tsx +35 -0
- package/template/src/navigation/RootNavigator.tsx +101 -0
- package/template/src/navigation/index.ts +5 -0
- package/template/src/navigation/navigationRef.ts +5 -0
- package/template/src/providers/QueryProvider.tsx +30 -0
- package/template/src/screens/DetailsScreen.tsx +271 -0
- package/template/src/screens/HomeScreen.tsx +736 -0
- package/template/src/screens/ProfileScreen.tsx +202 -0
- package/template/src/screens/SettingsScreen.tsx +253 -0
- package/template/src/screens/SportHubScreen.tsx +280 -0
- package/template/src/screens/auth/AddMamber.tsx +428 -0
- package/template/src/screens/auth/ForgotPasswordScreen.tsx +176 -0
- package/template/src/screens/auth/LoginScreen.tsx +286 -0
- package/template/src/screens/auth/OTPVerifyScreen.tsx +359 -0
- package/template/src/screens/auth/RegisterScreen.tsx +430 -0
- package/template/src/screens/auth/SuccessScreen.tsx +201 -0
- package/template/src/screens/auth/WalcomeScreen.tsx +274 -0
- package/template/src/screens/auth/index.ts +8 -0
- package/template/src/screens/chat/ChatScreen.tsx +1819 -0
- package/template/src/screens/chat/ChatThreadsScreen.tsx +360 -0
- package/template/src/screens/chat/ReportMessageScreen.tsx +238 -0
- package/template/src/screens/clubs/Announcements.tsx +426 -0
- package/template/src/screens/clubs/BuyRaffleTicketsScreen.tsx +568 -0
- package/template/src/screens/clubs/ClubDeteils.tsx +497 -0
- package/template/src/screens/clubs/JoinClub.tsx +841 -0
- package/template/src/screens/events/EventScreen.tsx +460 -0
- package/template/src/screens/index.ts +42 -0
- package/template/src/screens/raffles/MyReferralMembersScreen.tsx +758 -0
- package/template/src/screens/raffles/RaffleDetailsScreen.tsx +762 -0
- package/template/src/screens/raffles/RafflesScreen.tsx +495 -0
- package/template/src/screens/raffles/SetRaffleReminderScreen.tsx +390 -0
- package/template/src/screens/teams/JoinTeamScreen.tsx +464 -0
- package/template/src/screens/teams/MyTeamDetailsScreen.tsx +979 -0
- package/template/src/screens/teams/MyTeamScreen.tsx +568 -0
- package/template/src/screens/teams/PendingRequestsScreen.tsx +426 -0
- package/template/src/screens/volunteerOpportunities/SetReminderScreen.tsx +631 -0
- package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesDetailsScreen.tsx +1049 -0
- package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesScreen.tsx +608 -0
- package/template/src/services/api.ts +167 -0
- package/template/src/services/authService.ts +422 -0
- package/template/src/services/index.ts +5 -0
- package/template/src/services/mainServices.ts +1963 -0
- package/template/src/stores/authStore.ts +159 -0
- package/template/src/stores/index.ts +2 -0
- package/template/src/types/index.ts +85 -0
- package/template/src/types/navigation.ts +206 -0
- package/template/src/utils/AzureUploaderService.ts +371 -0
- package/template/src/utils/ClubSearchManager.ts +222 -0
- package/template/src/utils/NotificationManager.ts +503 -0
- package/template/src/utils/UploadDebugUtil.ts +107 -0
- package/template/src/utils/imagePicker.ts +321 -0
- package/template/src/utils/index.ts +111 -0
- package/template/src/utils/permissions.ts +277 -0
- package/template/src/utils/scaling.ts +14 -0
- package/template/src/utils/storage.ts +247 -0
- package/template/src/utils/usePermissions.ts +275 -0
- package/template/src/utils/validation.ts +340 -0
- package/template/tsconfig.json +50 -0
- package/template/types/svg.d.ts +6 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
Keyboard,
|
|
8
|
+
Platform,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import { Button, hideLoader, showLoader, TextInput } from '../../components/common';
|
|
11
|
+
import { theme } from '../../constants';
|
|
12
|
+
import { Strings } from '../../constants/strings';
|
|
13
|
+
import { Validation } from '../../utils';
|
|
14
|
+
import { ImageBackground } from 'react-native';
|
|
15
|
+
import Images from '../../assets/images';
|
|
16
|
+
import SVG from '../../assets/icons';
|
|
17
|
+
import { moderateScale } from '../../utils/scaling';
|
|
18
|
+
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
19
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
20
|
+
import { StatusBar } from 'react-native';
|
|
21
|
+
import { Fonts } from '../../constants/Fonts';
|
|
22
|
+
import ToastManager from '../../components/common/ToastManager';
|
|
23
|
+
import { useForgotPassword } from '../../services/authService';
|
|
24
|
+
|
|
25
|
+
interface ForgotPasswordScreenProps {
|
|
26
|
+
navigation: any;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const ForgotPasswordScreen: React.FC<ForgotPasswordScreenProps> = ({ navigation }) => {
|
|
30
|
+
const [email, setEmail] = useState('');
|
|
31
|
+
const forgotPasswordMutation = useForgotPassword();
|
|
32
|
+
|
|
33
|
+
const handleSubmit = async () => {
|
|
34
|
+
Keyboard.dismiss();
|
|
35
|
+
if (!Validation.validateForgotPasswordFormAndShowErrors(email)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
showLoader();
|
|
40
|
+
forgotPasswordMutation.mutate({ email: email }
|
|
41
|
+
, {
|
|
42
|
+
onSuccess: (response) => {
|
|
43
|
+
navigation.reset({
|
|
44
|
+
index: 0,
|
|
45
|
+
routes: [{ name: 'Login' }],
|
|
46
|
+
});
|
|
47
|
+
ToastManager.success(response.data.message || 'Forgot password successful!');
|
|
48
|
+
hideLoader();
|
|
49
|
+
},
|
|
50
|
+
onError: (error: any) => {
|
|
51
|
+
console.error('Forgot password error:', error);
|
|
52
|
+
if (error.response?.data?.message) {
|
|
53
|
+
ToastManager.error( error.response.data.message);
|
|
54
|
+
} else if (error.message) {
|
|
55
|
+
ToastManager.error( error.message);
|
|
56
|
+
} else {
|
|
57
|
+
ToastManager.error('Something went wrong. Please try again.');
|
|
58
|
+
}
|
|
59
|
+
hideLoader();
|
|
60
|
+
},
|
|
61
|
+
onSettled: () => {
|
|
62
|
+
hideLoader();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const onEmailChange = (text: string) => {
|
|
70
|
+
const trimmedText = text.trim();
|
|
71
|
+
setEmail(trimmedText);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<ImageBackground
|
|
77
|
+
source={Images.backgroundImage}
|
|
78
|
+
style={styles.backgroundImage}
|
|
79
|
+
resizeMode="contain"
|
|
80
|
+
>
|
|
81
|
+
<SafeAreaView edges={['top']} style={{ flex: 1 }}>
|
|
82
|
+
<StatusBar
|
|
83
|
+
barStyle="dark-content"
|
|
84
|
+
backgroundColor={theme.colors.background}
|
|
85
|
+
translucent={Platform.OS === 'android' ? true : false}
|
|
86
|
+
/>
|
|
87
|
+
<KeyboardAwareScrollView
|
|
88
|
+
enableOnAndroid={true}
|
|
89
|
+
contentContainerStyle={styles.container}
|
|
90
|
+
keyboardShouldPersistTaps="handled"
|
|
91
|
+
>
|
|
92
|
+
<TouchableOpacity style={{ marginLeft: theme.spacing.md }} onPress={() => navigation.goBack()}>
|
|
93
|
+
<SVG.arrowLeft height={moderateScale(30)} width={moderateScale(30)} style={styles.logoIcon} />
|
|
94
|
+
</TouchableOpacity>
|
|
95
|
+
<View style={styles.logoSection}>
|
|
96
|
+
<SVG.login_logo height={moderateScale(150)} width={moderateScale(150)} style={styles.logoIcon} />
|
|
97
|
+
</View>
|
|
98
|
+
|
|
99
|
+
{/* Login Form */}
|
|
100
|
+
<View style={styles.loginSection}>
|
|
101
|
+
<Text style={styles.loginTitle}>{Strings.AUTH.FORGOT_PASSWORD_TITLE}</Text>
|
|
102
|
+
<Text style={styles.loginSubTitle}>{Strings.AUTH.FORGOT_PASSWORD_SUBTITLE}</Text>
|
|
103
|
+
|
|
104
|
+
<View style={styles.form}>
|
|
105
|
+
<TextInput
|
|
106
|
+
label={Strings.COMMON.EMAIL}
|
|
107
|
+
value={email}
|
|
108
|
+
onChangeText={onEmailChange}
|
|
109
|
+
placeholder={Strings.COMMON.EMAIL_PLACEHOLDER}
|
|
110
|
+
keyboardType="email-address"
|
|
111
|
+
autoCapitalize="none"
|
|
112
|
+
autoCorrect={false}
|
|
113
|
+
variant="outlined"
|
|
114
|
+
leftIcon={SVG.Email}
|
|
115
|
+
maxLength={50}
|
|
116
|
+
/>
|
|
117
|
+
<Button
|
|
118
|
+
title={Strings.COMMON.SUBMIT}
|
|
119
|
+
onPress={handleSubmit}
|
|
120
|
+
variant="primary"
|
|
121
|
+
size="medium"
|
|
122
|
+
style={styles.button}
|
|
123
|
+
/>
|
|
124
|
+
</View>
|
|
125
|
+
</View>
|
|
126
|
+
</KeyboardAwareScrollView>
|
|
127
|
+
</SafeAreaView>
|
|
128
|
+
</ImageBackground>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const styles = StyleSheet.create({
|
|
133
|
+
backgroundImage: {
|
|
134
|
+
flex: 1,
|
|
135
|
+
width: '100%',
|
|
136
|
+
height: '100%',
|
|
137
|
+
},
|
|
138
|
+
container: {
|
|
139
|
+
flexGrow: 1,
|
|
140
|
+
},
|
|
141
|
+
// Logo Section
|
|
142
|
+
logoSection: {
|
|
143
|
+
justifyContent: 'center',
|
|
144
|
+
alignItems: 'center',
|
|
145
|
+
},
|
|
146
|
+
logoIcon: {
|
|
147
|
+
marginBottom: theme.spacing.xs,
|
|
148
|
+
},
|
|
149
|
+
// Login Section
|
|
150
|
+
loginSection: {
|
|
151
|
+
flex: 1,
|
|
152
|
+
backgroundColor: theme.colors.background,
|
|
153
|
+
paddingHorizontal: theme.spacing.lg,
|
|
154
|
+
borderTopLeftRadius: moderateScale(30),
|
|
155
|
+
borderTopRightRadius: moderateScale(30),
|
|
156
|
+
paddingTop: moderateScale(20),
|
|
157
|
+
},
|
|
158
|
+
loginTitle: {
|
|
159
|
+
fontFamily: Fonts.outfitSemiBold,
|
|
160
|
+
fontSize: moderateScale(24),
|
|
161
|
+
color: theme.colors.black,
|
|
162
|
+
marginBottom: theme.spacing.sm,
|
|
163
|
+
},
|
|
164
|
+
loginSubTitle: {
|
|
165
|
+
fontFamily: Fonts.outfitRegular,
|
|
166
|
+
fontSize: moderateScale(13),
|
|
167
|
+
color: theme.colors.black,
|
|
168
|
+
marginBottom: theme.spacing.md,
|
|
169
|
+
},
|
|
170
|
+
form: {
|
|
171
|
+
gap: theme.spacing.sm,
|
|
172
|
+
},
|
|
173
|
+
button: {
|
|
174
|
+
marginTop: theme.spacing.md,
|
|
175
|
+
}
|
|
176
|
+
});
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
ImageBackground,
|
|
7
|
+
StatusBar,
|
|
8
|
+
Platform,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import { Button, TextInput } from '../../components/common';
|
|
11
|
+
import { theme } from '../../constants';
|
|
12
|
+
import { Strings } from '../../constants/strings';
|
|
13
|
+
import { validateEmail, validatePassword } from '../../utils';
|
|
14
|
+
import SVG from '../../assets/icons';
|
|
15
|
+
import Images from '../../assets/images';
|
|
16
|
+
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
17
|
+
import { moderateScale, verticalScale } from '../../utils/scaling';
|
|
18
|
+
import { Fonts } from '../../constants/Fonts';
|
|
19
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
20
|
+
import { hideLoader, showLoader } from '../../components/common/AppLoader';
|
|
21
|
+
import ToastManager from '../../components/common/ToastManager';
|
|
22
|
+
import { useLogin, getApiErrorInfo } from '../../services/authService';
|
|
23
|
+
import { useAuthStore } from '../../stores/authStore';
|
|
24
|
+
import NotificationManager from '../../utils/NotificationManager';
|
|
25
|
+
|
|
26
|
+
interface LoginScreenProps {
|
|
27
|
+
navigation: any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const LoginScreen: React.FC<LoginScreenProps> = ({ navigation }) => {
|
|
31
|
+
const [email, setEmail] = useState('');
|
|
32
|
+
const [password, setPassword] = useState('');
|
|
33
|
+
|
|
34
|
+
const loginMutation = useLogin();
|
|
35
|
+
const login = useAuthStore((state) => state.login);
|
|
36
|
+
|
|
37
|
+
const onEmailChange = (text: string) => {
|
|
38
|
+
const trimmedText = text.trim();
|
|
39
|
+
setEmail(trimmedText);
|
|
40
|
+
};
|
|
41
|
+
const onPasswordChange = (text: string) => {
|
|
42
|
+
const trimmedText = text.trim();
|
|
43
|
+
setPassword(trimmedText);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const getToken = async () => {
|
|
48
|
+
const token = await NotificationManager.getFCMToken();
|
|
49
|
+
|
|
50
|
+
console.log("FCM token:", token);
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
getToken();
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
const validateForm = () => {
|
|
58
|
+
if (!email.trim()) {
|
|
59
|
+
ToastManager.error('Email is required');
|
|
60
|
+
return false;
|
|
61
|
+
} else if (!validateEmail(email)) {
|
|
62
|
+
ToastManager.error('Please enter a valid email address');
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!password.trim()) {
|
|
67
|
+
ToastManager.error('Password is required');
|
|
68
|
+
return false;
|
|
69
|
+
} else if (!validatePassword(password)) {
|
|
70
|
+
ToastManager.error('Password must be at least 8 characters long');
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const handleLogin = () => {
|
|
78
|
+
if (!validateForm()) return;
|
|
79
|
+
showLoader();
|
|
80
|
+
loginMutation.mutate({
|
|
81
|
+
email,
|
|
82
|
+
password
|
|
83
|
+
}, {
|
|
84
|
+
onSuccess: (response) => {
|
|
85
|
+
// Check if it's a 409 status (OTP verification needed)
|
|
86
|
+
if (response.status === 409) {
|
|
87
|
+
ToastManager.error(response.data.message || 'OTP verification required');
|
|
88
|
+
navigation.navigate('OTPVerify', { email: email });
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
} else {
|
|
92
|
+
// Normal login success
|
|
93
|
+
const userData = {
|
|
94
|
+
userId: response?.data?.data?.userId,
|
|
95
|
+
email: response?.data?.data?.email,
|
|
96
|
+
Name: response?.data?.data?.Name,
|
|
97
|
+
profileImage: response?.data?.data?.profileImage,
|
|
98
|
+
isProfileCompleted: response?.data?.data?.isProfileCompleted,
|
|
99
|
+
isAddMember: response?.data?.data?.isAddMember || false,
|
|
100
|
+
userType: response?.data?.data?.userType,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
login(userData, response?.data?.data?.accessToken, response?.data?.data?.authorizationToken);
|
|
104
|
+
ToastManager.success(response.data.message || 'Welcome back!');
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
onError: (error: any) => {
|
|
108
|
+
const errorInfo = getApiErrorInfo(error);
|
|
109
|
+
if (errorInfo.statusCode === 401) {
|
|
110
|
+
console.log('Login error===>>>>14', errorInfo);
|
|
111
|
+
} else {
|
|
112
|
+
ToastManager.error(errorInfo?.message);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
onSettled: () => {
|
|
116
|
+
hideLoader();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const navigateToRegister = () => {
|
|
122
|
+
navigation.navigate('Register');
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const navigateToForgotPassword = () => {
|
|
126
|
+
navigation.navigate('ForgotPassword');
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<ImageBackground
|
|
132
|
+
source={Images.backgroundImage}
|
|
133
|
+
style={styles.backgroundImage}
|
|
134
|
+
resizeMode="contain"
|
|
135
|
+
>
|
|
136
|
+
<SafeAreaView edges={['top']} style={{ flex: 1 }}>
|
|
137
|
+
<StatusBar
|
|
138
|
+
barStyle="dark-content"
|
|
139
|
+
backgroundColor={theme.colors.background}
|
|
140
|
+
translucent={Platform.OS === 'android' ? true : false}
|
|
141
|
+
/>
|
|
142
|
+
<KeyboardAwareScrollView
|
|
143
|
+
enableOnAndroid={true}
|
|
144
|
+
contentContainerStyle={styles.container}
|
|
145
|
+
keyboardShouldPersistTaps="handled"
|
|
146
|
+
>
|
|
147
|
+
<View style={styles.logoSection}>
|
|
148
|
+
<SVG.login_logo height={moderateScale(150)} width={moderateScale(150)} style={styles.logoIcon} />
|
|
149
|
+
</View>
|
|
150
|
+
|
|
151
|
+
{/* Login Form */}
|
|
152
|
+
<View style={styles.loginSection}>
|
|
153
|
+
<Text style={styles.loginTitle}>{Strings.AUTH.LOGIN_TITLE}</Text>
|
|
154
|
+
|
|
155
|
+
<View style={styles.form}>
|
|
156
|
+
<TextInput
|
|
157
|
+
label={Strings.COMMON.EMAIL}
|
|
158
|
+
value={email}
|
|
159
|
+
onChangeText={onEmailChange}
|
|
160
|
+
placeholder={Strings.COMMON.EMAIL_PLACEHOLDER}
|
|
161
|
+
keyboardType="email-address"
|
|
162
|
+
autoCapitalize="none"
|
|
163
|
+
autoCorrect={false}
|
|
164
|
+
variant="outlined"
|
|
165
|
+
leftIcon={SVG.Email}
|
|
166
|
+
maxLength={50}
|
|
167
|
+
/>
|
|
168
|
+
|
|
169
|
+
<TextInput
|
|
170
|
+
label={Strings.COMMON.PASSWORD}
|
|
171
|
+
value={password}
|
|
172
|
+
onChangeText={onPasswordChange}
|
|
173
|
+
placeholder={Strings.COMMON.PASSWORD_PLACEHOLDER}
|
|
174
|
+
secureTextEntry
|
|
175
|
+
autoCapitalize="none"
|
|
176
|
+
autoCorrect={false}
|
|
177
|
+
leftIcon={SVG.Password}
|
|
178
|
+
showPasswordToggle
|
|
179
|
+
variant="outlined"
|
|
180
|
+
maxLength={30}
|
|
181
|
+
/>
|
|
182
|
+
|
|
183
|
+
<View style={styles.forgotPasswordContainer}>
|
|
184
|
+
<Button
|
|
185
|
+
title={Strings.COMMON.FORGOT_PASSWORD}
|
|
186
|
+
onPress={navigateToForgotPassword}
|
|
187
|
+
variant="outline"
|
|
188
|
+
style={styles.forgotButton}
|
|
189
|
+
textStyle={styles.forgotButtonText}
|
|
190
|
+
/>
|
|
191
|
+
</View>
|
|
192
|
+
|
|
193
|
+
<Button
|
|
194
|
+
title={Strings.COMMON.LOGIN}
|
|
195
|
+
onPress={handleLogin}
|
|
196
|
+
variant="primary"
|
|
197
|
+
size="medium"
|
|
198
|
+
/>
|
|
199
|
+
|
|
200
|
+
<View style={styles.divider}>
|
|
201
|
+
<SVG.OR_separator />
|
|
202
|
+
</View>
|
|
203
|
+
|
|
204
|
+
<Button
|
|
205
|
+
title={Strings.COMMON.SIGN_UP}
|
|
206
|
+
onPress={navigateToRegister}
|
|
207
|
+
variant="outline"
|
|
208
|
+
textStyle={styles.signUpButtonText}
|
|
209
|
+
size="medium"
|
|
210
|
+
/>
|
|
211
|
+
</View>
|
|
212
|
+
</View>
|
|
213
|
+
</KeyboardAwareScrollView>
|
|
214
|
+
</SafeAreaView>
|
|
215
|
+
</ImageBackground>
|
|
216
|
+
);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const styles = StyleSheet.create({
|
|
220
|
+
backgroundImage: {
|
|
221
|
+
flex: 1,
|
|
222
|
+
width: '100%',
|
|
223
|
+
height: '100%',
|
|
224
|
+
},
|
|
225
|
+
container: {
|
|
226
|
+
flexGrow: 1,
|
|
227
|
+
},
|
|
228
|
+
// Logo Section
|
|
229
|
+
logoSection: {
|
|
230
|
+
justifyContent: 'center',
|
|
231
|
+
alignItems: 'center',
|
|
232
|
+
marginTop: verticalScale(50)
|
|
233
|
+
},
|
|
234
|
+
logoIcon: {
|
|
235
|
+
marginBottom: theme.spacing.md,
|
|
236
|
+
},
|
|
237
|
+
// Login Section
|
|
238
|
+
loginSection: {
|
|
239
|
+
flex: 1,
|
|
240
|
+
backgroundColor: theme.colors.background,
|
|
241
|
+
paddingHorizontal: theme.spacing.lg,
|
|
242
|
+
borderTopLeftRadius: moderateScale(30),
|
|
243
|
+
borderTopRightRadius: moderateScale(30),
|
|
244
|
+
paddingTop: moderateScale(20),
|
|
245
|
+
},
|
|
246
|
+
loginTitle: {
|
|
247
|
+
fontFamily: Fonts.outfitSemiBold,
|
|
248
|
+
fontSize: moderateScale(24),
|
|
249
|
+
color: theme.colors.black,
|
|
250
|
+
marginBottom: theme.spacing.md,
|
|
251
|
+
},
|
|
252
|
+
form: {
|
|
253
|
+
gap: theme.spacing.sm,
|
|
254
|
+
},
|
|
255
|
+
forgotPasswordContainer: {
|
|
256
|
+
alignItems: 'flex-end',
|
|
257
|
+
marginTop: -8,
|
|
258
|
+
},
|
|
259
|
+
forgotButton: {
|
|
260
|
+
backgroundColor: 'transparent',
|
|
261
|
+
borderColor: 'transparent',
|
|
262
|
+
shadowOpacity: 0,
|
|
263
|
+
elevation: 0,
|
|
264
|
+
paddingHorizontal: 0,
|
|
265
|
+
paddingVertical: 4,
|
|
266
|
+
minHeight: 'auto',
|
|
267
|
+
},
|
|
268
|
+
forgotButtonText: {
|
|
269
|
+
color: theme.colors.appleGreen,
|
|
270
|
+
fontSize: theme.typography.fontSize.sm,
|
|
271
|
+
fontFamily: Fonts.outfitRegular,
|
|
272
|
+
},
|
|
273
|
+
divider: {
|
|
274
|
+
flexDirection: 'row',
|
|
275
|
+
alignItems: 'center',
|
|
276
|
+
justifyContent: 'center',
|
|
277
|
+
marginVertical: theme.spacing.sm,
|
|
278
|
+
},
|
|
279
|
+
signUpButton: {
|
|
280
|
+
borderColor: theme.colors.appleGreen,
|
|
281
|
+
},
|
|
282
|
+
signUpButtonText: {
|
|
283
|
+
color: theme.colors.appleGreen,
|
|
284
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
285
|
+
},
|
|
286
|
+
});
|