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.
- 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,568 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
StatusBar,
|
|
7
|
+
Platform,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
Alert,
|
|
10
|
+
ActivityIndicator,
|
|
11
|
+
Image,
|
|
12
|
+
Keyboard,
|
|
13
|
+
} from 'react-native';
|
|
14
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
15
|
+
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
16
|
+
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
17
|
+
import { theme } from '@constants';
|
|
18
|
+
import { moderateScale } from '@utils/scaling';
|
|
19
|
+
import { Fonts } from '@constants/Fonts';
|
|
20
|
+
import SVG from '@assets/icons';
|
|
21
|
+
import { MainStackParamList } from '@navigation';
|
|
22
|
+
import { useVerifyReferralCode } from '@services/mainServices';
|
|
23
|
+
import { getApiErrorInfo } from '@services';
|
|
24
|
+
import { TextInput } from '@components/common';
|
|
25
|
+
|
|
26
|
+
// Helper function to format currency
|
|
27
|
+
const formatCurrency = (amount: number): string => {
|
|
28
|
+
return new Intl.NumberFormat('en-US', {
|
|
29
|
+
style: 'currency',
|
|
30
|
+
currency: 'USD',
|
|
31
|
+
}).format(amount);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type BuyRaffleTicketsScreenProps = NativeStackScreenProps<MainStackParamList, 'BuyRaffleTickets'>;
|
|
35
|
+
|
|
36
|
+
interface TicketOption {
|
|
37
|
+
id: number;
|
|
38
|
+
raffleId: number;
|
|
39
|
+
ticketCount: number;
|
|
40
|
+
totalAmount: number;
|
|
41
|
+
perTicketAmount: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const BuyRaffleTicketsScreen: React.FC<BuyRaffleTicketsScreenProps> = ({ navigation, route }) => {
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
selectedClub,
|
|
48
|
+
selectedMember,
|
|
49
|
+
raffleId,
|
|
50
|
+
raffleTitle,
|
|
51
|
+
ticketOptions,
|
|
52
|
+
} = route.params;
|
|
53
|
+
|
|
54
|
+
const [selectedTicket, setSelectedTicket] = useState<TicketOption | null>(null);
|
|
55
|
+
const [referralCode, setReferralCode] = useState('');
|
|
56
|
+
const [isProcessing, setIsProcessing] = useState(false);
|
|
57
|
+
const [referralError, setReferralError] = useState<string | null>(null);
|
|
58
|
+
const scrollViewRef = useRef<KeyboardAwareScrollView>(null);
|
|
59
|
+
|
|
60
|
+
const verifyReferralCodeMutation = useVerifyReferralCode();
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
// Set first ticket as default selection
|
|
64
|
+
if (ticketOptions && ticketOptions.length > 0) {
|
|
65
|
+
setSelectedTicket(ticketOptions[0]);
|
|
66
|
+
}
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
const handleSelectTicket = (ticket: TicketOption) => {
|
|
70
|
+
setSelectedTicket(ticket);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const handlePlaceOrder = async () => {
|
|
74
|
+
Keyboard.dismiss();
|
|
75
|
+
setReferralError(null);
|
|
76
|
+
if (!selectedTicket) {
|
|
77
|
+
Alert.alert('Select Tickets', 'Please select a ticket package first.');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
Alert.alert(
|
|
82
|
+
'Payment Integration Required',
|
|
83
|
+
'Payment processing functionality needs to be implemented. Please integrate your preferred payment gateway.',
|
|
84
|
+
[{ text: 'OK' }]
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
/*
|
|
88
|
+
// TODO: Implement payment processing logic here
|
|
89
|
+
// Example implementation structure:
|
|
90
|
+
|
|
91
|
+
setIsProcessing(true);
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
// Verify referral code if present
|
|
95
|
+
if (referralCode.trim()) {
|
|
96
|
+
try {
|
|
97
|
+
const verifyResult = await verifyReferralCodeMutation.mutateAsync({
|
|
98
|
+
raffleId: raffleId,
|
|
99
|
+
clubId: selectedClub?.id || 0,
|
|
100
|
+
memberId: selectedMember?.id || 0,
|
|
101
|
+
referralCode: referralCode.trim()
|
|
102
|
+
});
|
|
103
|
+
console.log("verifyResult====?", verifyResult);
|
|
104
|
+
|
|
105
|
+
} catch (error: any) {
|
|
106
|
+
const errorInfo = getApiErrorInfo(error);
|
|
107
|
+
console.error('[BuyRaffleTicketsScreen]', errorInfo);
|
|
108
|
+
setReferralError(errorInfo?.message || 'Invalid referral code');
|
|
109
|
+
setIsProcessing(false);
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
scrollViewRef.current?.scrollToEnd(true);
|
|
112
|
+
}, 100);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Process payment with your payment gateway
|
|
118
|
+
// const paymentResult = await yourPaymentService.processPayment({
|
|
119
|
+
// amount: selectedTicket.totalAmount,
|
|
120
|
+
// ticketInfo: selectedTicket,
|
|
121
|
+
// referralCode: referralCode
|
|
122
|
+
// });
|
|
123
|
+
|
|
124
|
+
// if (paymentResult.success) {
|
|
125
|
+
// Alert.alert(
|
|
126
|
+
// 'Purchase Successful',
|
|
127
|
+
// `You've purchased ${selectedTicket.ticketCount} raffle ticket${selectedTicket.ticketCount > 1 ? 's' : ''} for ${raffleTitle}!\n\nGood luck! 🍀`,
|
|
128
|
+
// [
|
|
129
|
+
// {
|
|
130
|
+
// text: 'OK',
|
|
131
|
+
// onPress: () => {
|
|
132
|
+
// navigation.navigate('ClubDetails', {
|
|
133
|
+
// selectedClub,
|
|
134
|
+
// selectedMember
|
|
135
|
+
// });
|
|
136
|
+
// },
|
|
137
|
+
// },
|
|
138
|
+
// ]
|
|
139
|
+
// );
|
|
140
|
+
// }
|
|
141
|
+
} catch (error: any) {
|
|
142
|
+
console.error('[BuyRaffleTicketsScreen] Payment error:', error);
|
|
143
|
+
Alert.alert(
|
|
144
|
+
'Payment Failed',
|
|
145
|
+
error?.message || 'Unable to process payment. Please try again.',
|
|
146
|
+
[{ text: 'OK' }]
|
|
147
|
+
);
|
|
148
|
+
} finally {
|
|
149
|
+
setIsProcessing(false);
|
|
150
|
+
}
|
|
151
|
+
*/
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const renderTicketOption = ({ item }: { item: TicketOption }) => {
|
|
155
|
+
const isSelected = selectedTicket?.id === item.id;
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<TouchableOpacity
|
|
159
|
+
style={[styles.ticketOption, isSelected && styles.ticketOptionSelected]}
|
|
160
|
+
onPress={() => handleSelectTicket(item)}
|
|
161
|
+
activeOpacity={0.7}
|
|
162
|
+
>
|
|
163
|
+
<View style={[styles.radioButton, isSelected && styles.radioButtonSelected]}>
|
|
164
|
+
{isSelected && <View style={styles.radioButtonInner} />}
|
|
165
|
+
</View>
|
|
166
|
+
<View style={styles.ticketInfo}>
|
|
167
|
+
<Text style={styles.ticketText}>
|
|
168
|
+
{item.ticketCount} ticket{item.ticketCount > 1 ? 's' : ''} for{' '}
|
|
169
|
+
<Text style={styles.ticketPrice}>{formatCurrency(item.totalAmount)}</Text>
|
|
170
|
+
{' '}
|
|
171
|
+
<Text style={styles.ticketPricePerUnit}>
|
|
172
|
+
({formatCurrency(item.perTicketAmount)} ea)
|
|
173
|
+
</Text>
|
|
174
|
+
</Text>
|
|
175
|
+
</View>
|
|
176
|
+
</TouchableOpacity>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const renderFooter = () => (
|
|
181
|
+
<View style={styles.footerContainer}>
|
|
182
|
+
<View style={styles.totalContainer}>
|
|
183
|
+
<Text style={styles.totalLabel}>Total Amount:</Text>
|
|
184
|
+
<Text style={styles.totalAmount}>
|
|
185
|
+
{selectedTicket ? formatCurrency(selectedTicket.totalAmount) : '$0.00'}
|
|
186
|
+
</Text>
|
|
187
|
+
</View>
|
|
188
|
+
|
|
189
|
+
<View style={styles.inputContainer}>
|
|
190
|
+
{/* <TextInput
|
|
191
|
+
style={[styles.input, !!referralError && styles.inputError]}
|
|
192
|
+
placeholder="Enter referral code"
|
|
193
|
+
placeholderTextColor={theme.colors.textSecondary}
|
|
194
|
+
value={referralCode}
|
|
195
|
+
onChangeText={(text) => {
|
|
196
|
+
setReferralCode(text);
|
|
197
|
+
if (referralError) setReferralError(null);
|
|
198
|
+
}}
|
|
199
|
+
autoCapitalize="characters"
|
|
200
|
+
/> */}
|
|
201
|
+
|
|
202
|
+
<TextInput
|
|
203
|
+
style={styles.input}
|
|
204
|
+
placeholder="Enter referral code"
|
|
205
|
+
placeholderTextColor={theme.colors.textSecondary}
|
|
206
|
+
value={referralCode}
|
|
207
|
+
maxLength={10}
|
|
208
|
+
textAlign='center'
|
|
209
|
+
onChangeText={(text) => {
|
|
210
|
+
setReferralCode(text);
|
|
211
|
+
if (referralError) setReferralError(null);
|
|
212
|
+
}}
|
|
213
|
+
autoCapitalize="characters"
|
|
214
|
+
/>
|
|
215
|
+
{!!referralError && (
|
|
216
|
+
<Text style={styles.errorText}>{referralError}</Text>
|
|
217
|
+
)}
|
|
218
|
+
</View>
|
|
219
|
+
|
|
220
|
+
<TouchableOpacity
|
|
221
|
+
style={[styles.placeOrderButton, (!selectedTicket || isProcessing) && styles.placeOrderButtonDisabled]}
|
|
222
|
+
onPress={handlePlaceOrder}
|
|
223
|
+
disabled={!selectedTicket || isProcessing}
|
|
224
|
+
activeOpacity={0.8}
|
|
225
|
+
>
|
|
226
|
+
{isProcessing ? (
|
|
227
|
+
<>
|
|
228
|
+
<ActivityIndicator color="#fff" style={{ marginRight: 10 }} />
|
|
229
|
+
<Text style={styles.placeOrderButtonText}>Processing...</Text>
|
|
230
|
+
</>
|
|
231
|
+
) : (
|
|
232
|
+
<Text style={styles.placeOrderButtonText}>Place Order</Text>
|
|
233
|
+
)}
|
|
234
|
+
</TouchableOpacity>
|
|
235
|
+
|
|
236
|
+
<View style={styles.paymentMethodsContainer}>
|
|
237
|
+
<Text style={styles.paymentMethodsText}>💳 Payment Gateway Not Configured</Text>
|
|
238
|
+
</View>
|
|
239
|
+
</View>
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<View style={styles.container}>
|
|
244
|
+
<StatusBar
|
|
245
|
+
barStyle="light-content"
|
|
246
|
+
backgroundColor={theme.colors.blue}
|
|
247
|
+
translucent={Platform.OS === 'android' ? true : false}
|
|
248
|
+
/>
|
|
249
|
+
{Platform.OS === 'ios' && <View style={styles.statusBarBackground} />}
|
|
250
|
+
|
|
251
|
+
<SafeAreaView style={styles.header}>
|
|
252
|
+
<View style={{ flexDirection: 'row', paddingHorizontal: theme.spacing.lg }}>
|
|
253
|
+
<TouchableOpacity onPress={() => navigation.goBack()}>
|
|
254
|
+
<SVG.arrowLeft_white width={moderateScale(25)} height={moderateScale(25)} />
|
|
255
|
+
</TouchableOpacity>
|
|
256
|
+
<View style={{ flexDirection: 'row' }}>
|
|
257
|
+
<View style={styles.userConSty}>
|
|
258
|
+
{!!selectedClub?.clubImage ? (
|
|
259
|
+
<Image
|
|
260
|
+
source={{ uri: selectedClub?.clubImage }}
|
|
261
|
+
resizeMode='cover'
|
|
262
|
+
style={styles.userDetailsSty}
|
|
263
|
+
/>
|
|
264
|
+
) : (
|
|
265
|
+
<View style={styles.placeholderLogoHeader}>
|
|
266
|
+
<SVG.UsersIcon width={moderateScale(20)} height={moderateScale(20)} />
|
|
267
|
+
</View>
|
|
268
|
+
)}
|
|
269
|
+
</View>
|
|
270
|
+
<Text style={styles.userNameSty}>{selectedClub?.clubName || 'Club'}</Text>
|
|
271
|
+
</View>
|
|
272
|
+
</View>
|
|
273
|
+
|
|
274
|
+
<View style={styles.content}>
|
|
275
|
+
<KeyboardAwareScrollView
|
|
276
|
+
ref={scrollViewRef}
|
|
277
|
+
showsVerticalScrollIndicator={false}
|
|
278
|
+
keyboardShouldPersistTaps="handled"
|
|
279
|
+
enableOnAndroid={true}
|
|
280
|
+
enableAutomaticScroll={true}
|
|
281
|
+
extraScrollHeight={moderateScale(100)}
|
|
282
|
+
keyboardOpeningTime={250}
|
|
283
|
+
contentContainerStyle={styles.scrollContent}
|
|
284
|
+
>
|
|
285
|
+
<Text style={styles.questionTitle}>How Many Tickets?</Text>
|
|
286
|
+
|
|
287
|
+
<View style={styles.listContent}>
|
|
288
|
+
{ticketOptions.map((item) => (
|
|
289
|
+
<View key={item.id}>
|
|
290
|
+
{renderTicketOption({ item })}
|
|
291
|
+
</View>
|
|
292
|
+
))}
|
|
293
|
+
|
|
294
|
+
{/* {renderFooter()} */}
|
|
295
|
+
<View style={styles.footerContainer}>
|
|
296
|
+
<View style={styles.totalContainer}>
|
|
297
|
+
<Text style={styles.totalLabel}>Total Amount:</Text>
|
|
298
|
+
<Text style={styles.totalAmount}>
|
|
299
|
+
{selectedTicket ? formatCurrency(selectedTicket.totalAmount) : '$0.00'}
|
|
300
|
+
</Text>
|
|
301
|
+
</View>
|
|
302
|
+
|
|
303
|
+
<View style={styles.inputContainer}>
|
|
304
|
+
<TextInput
|
|
305
|
+
style={styles.input}
|
|
306
|
+
placeholder="Enter referral code"
|
|
307
|
+
placeholderTextColor={theme.colors.textSecondary}
|
|
308
|
+
value={referralCode}
|
|
309
|
+
maxLength={10}
|
|
310
|
+
textAlign='center'
|
|
311
|
+
onChangeText={(text) => {
|
|
312
|
+
setReferralCode(text);
|
|
313
|
+
if (referralError) setReferralError(null);
|
|
314
|
+
}}
|
|
315
|
+
autoCapitalize="characters"
|
|
316
|
+
/>
|
|
317
|
+
{!!referralError && (
|
|
318
|
+
<Text style={styles.errorText}>{referralError}</Text>
|
|
319
|
+
)}
|
|
320
|
+
</View>
|
|
321
|
+
|
|
322
|
+
<TouchableOpacity
|
|
323
|
+
style={[styles.placeOrderButton, (!selectedTicket || isProcessing) && styles.placeOrderButtonDisabled]}
|
|
324
|
+
onPress={handlePlaceOrder}
|
|
325
|
+
disabled={!selectedTicket || isProcessing}
|
|
326
|
+
activeOpacity={0.8}
|
|
327
|
+
>
|
|
328
|
+
{isProcessing ? (
|
|
329
|
+
<>
|
|
330
|
+
<ActivityIndicator color="#fff" style={{ marginRight: 10 }} />
|
|
331
|
+
<Text style={styles.placeOrderButtonText}>Processing...</Text>
|
|
332
|
+
</>
|
|
333
|
+
) : (
|
|
334
|
+
<Text style={styles.placeOrderButtonText}>Place Order</Text>
|
|
335
|
+
)}
|
|
336
|
+
</TouchableOpacity>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
</View>
|
|
340
|
+
</View>
|
|
341
|
+
</KeyboardAwareScrollView>
|
|
342
|
+
</View>
|
|
343
|
+
</SafeAreaView>
|
|
344
|
+
|
|
345
|
+
{/* Full-screen loader during payment processing */}
|
|
346
|
+
{isProcessing && (
|
|
347
|
+
<View style={styles.loaderOverlay}><ActivityIndicator size="large" color={theme.colors.blue} /></View>
|
|
348
|
+
)}
|
|
349
|
+
</View>
|
|
350
|
+
);
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const styles = StyleSheet.create({
|
|
354
|
+
container: {
|
|
355
|
+
flex: 1,
|
|
356
|
+
backgroundColor: theme.colors.blue,
|
|
357
|
+
},
|
|
358
|
+
statusBarBackground: {
|
|
359
|
+
position: 'absolute',
|
|
360
|
+
top: 0,
|
|
361
|
+
left: 0,
|
|
362
|
+
right: 0,
|
|
363
|
+
height: Platform.OS === 'ios' ? 44 : 0,
|
|
364
|
+
backgroundColor: theme.colors.blue,
|
|
365
|
+
zIndex: 1000,
|
|
366
|
+
},
|
|
367
|
+
header: {
|
|
368
|
+
flex: 1,
|
|
369
|
+
backgroundColor: theme.colors.blue,
|
|
370
|
+
paddingVertical: theme.spacing.xs,
|
|
371
|
+
paddingTop: Platform.OS === 'android' ? theme.spacing.lg : theme.spacing.xs,
|
|
372
|
+
},
|
|
373
|
+
userConSty: {
|
|
374
|
+
marginHorizontal: moderateScale(10),
|
|
375
|
+
width: moderateScale(30),
|
|
376
|
+
height: moderateScale(30),
|
|
377
|
+
borderRadius: moderateScale(15),
|
|
378
|
+
borderWidth: 1.5,
|
|
379
|
+
borderColor: theme.colors.imageBorder,
|
|
380
|
+
backgroundColor: theme.colors.background,
|
|
381
|
+
alignItems: 'center',
|
|
382
|
+
justifyContent: 'center',
|
|
383
|
+
},
|
|
384
|
+
userNameSty: {
|
|
385
|
+
marginTop: moderateScale(5),
|
|
386
|
+
color: theme.colors.white,
|
|
387
|
+
fontFamily: Fonts.outfitMedium,
|
|
388
|
+
fontSize: moderateScale(15),
|
|
389
|
+
},
|
|
390
|
+
userDetailsSty: {
|
|
391
|
+
width: moderateScale(30),
|
|
392
|
+
height: moderateScale(30),
|
|
393
|
+
borderRadius: moderateScale(15),
|
|
394
|
+
},
|
|
395
|
+
placeholderLogoHeader: {
|
|
396
|
+
width: moderateScale(20),
|
|
397
|
+
height: moderateScale(20),
|
|
398
|
+
borderRadius: moderateScale(10),
|
|
399
|
+
alignItems: 'center',
|
|
400
|
+
justifyContent: 'center',
|
|
401
|
+
},
|
|
402
|
+
headerTitle: {
|
|
403
|
+
marginTop: moderateScale(20),
|
|
404
|
+
fontFamily: Fonts.outfitMedium,
|
|
405
|
+
fontSize: moderateScale(22),
|
|
406
|
+
color: theme.colors.white,
|
|
407
|
+
paddingHorizontal: theme.spacing.lg,
|
|
408
|
+
marginBottom: theme.spacing.sm,
|
|
409
|
+
},
|
|
410
|
+
content: {
|
|
411
|
+
flex: 1,
|
|
412
|
+
backgroundColor: theme.colors.white,
|
|
413
|
+
paddingHorizontal: theme.spacing.lg,
|
|
414
|
+
paddingTop: theme.spacing.md,
|
|
415
|
+
borderTopLeftRadius: moderateScale(30),
|
|
416
|
+
borderTopRightRadius: moderateScale(30),
|
|
417
|
+
marginTop: theme.spacing.md,
|
|
418
|
+
},
|
|
419
|
+
scrollContent: {
|
|
420
|
+
flexGrow: 1,
|
|
421
|
+
},
|
|
422
|
+
questionTitle: {
|
|
423
|
+
fontFamily: Fonts.outfitMedium,
|
|
424
|
+
fontSize: moderateScale(16),
|
|
425
|
+
color: theme.colors.black,
|
|
426
|
+
marginBottom: theme.spacing.md,
|
|
427
|
+
letterSpacing: 0.5,
|
|
428
|
+
},
|
|
429
|
+
listContent: {
|
|
430
|
+
paddingBottom: theme.spacing.xl,
|
|
431
|
+
},
|
|
432
|
+
ticketOption: {
|
|
433
|
+
flexDirection: 'row',
|
|
434
|
+
alignItems: 'center',
|
|
435
|
+
backgroundColor: theme.colors.lightLavenderGray,
|
|
436
|
+
borderRadius: moderateScale(12),
|
|
437
|
+
borderWidth: 2,
|
|
438
|
+
borderColor: theme.colors.border,
|
|
439
|
+
padding: theme.spacing.md,
|
|
440
|
+
marginBottom: theme.spacing.sm,
|
|
441
|
+
},
|
|
442
|
+
ticketOptionSelected: {
|
|
443
|
+
borderColor: theme.colors.blue,
|
|
444
|
+
backgroundColor: theme.colors.lightLavenderGray,
|
|
445
|
+
},
|
|
446
|
+
radioButton: {
|
|
447
|
+
width: moderateScale(24),
|
|
448
|
+
height: moderateScale(24),
|
|
449
|
+
borderRadius: moderateScale(12),
|
|
450
|
+
borderWidth: 2,
|
|
451
|
+
borderColor: theme.colors.border,
|
|
452
|
+
alignItems: 'center',
|
|
453
|
+
justifyContent: 'center',
|
|
454
|
+
marginRight: theme.spacing.md,
|
|
455
|
+
},
|
|
456
|
+
radioButtonSelected: {
|
|
457
|
+
borderColor: theme.colors.blue,
|
|
458
|
+
},
|
|
459
|
+
radioButtonInner: {
|
|
460
|
+
width: moderateScale(12),
|
|
461
|
+
height: moderateScale(12),
|
|
462
|
+
borderRadius: moderateScale(6),
|
|
463
|
+
backgroundColor: theme.colors.blue,
|
|
464
|
+
},
|
|
465
|
+
ticketInfo: {
|
|
466
|
+
flex: 1,
|
|
467
|
+
},
|
|
468
|
+
ticketText: {
|
|
469
|
+
fontFamily: Fonts.outfitRegular,
|
|
470
|
+
fontSize: moderateScale(15),
|
|
471
|
+
color: theme.colors.text,
|
|
472
|
+
},
|
|
473
|
+
ticketPrice: {
|
|
474
|
+
fontFamily: Fonts.outfitBold,
|
|
475
|
+
color: theme.colors.text,
|
|
476
|
+
},
|
|
477
|
+
ticketPricePerUnit: {
|
|
478
|
+
fontFamily: Fonts.outfitRegular,
|
|
479
|
+
fontSize: moderateScale(14),
|
|
480
|
+
color: theme.colors.blue,
|
|
481
|
+
},
|
|
482
|
+
footerContainer: {
|
|
483
|
+
marginTop: theme.spacing.lg,
|
|
484
|
+
},
|
|
485
|
+
totalContainer: {
|
|
486
|
+
flexDirection: 'row',
|
|
487
|
+
alignItems: 'center',
|
|
488
|
+
justifyContent: 'center',
|
|
489
|
+
marginBottom: theme.spacing.lg,
|
|
490
|
+
},
|
|
491
|
+
totalLabel: {
|
|
492
|
+
fontFamily: Fonts.outfitRegular,
|
|
493
|
+
fontSize: moderateScale(16),
|
|
494
|
+
color: theme.colors.text,
|
|
495
|
+
marginRight: theme.spacing.sm,
|
|
496
|
+
},
|
|
497
|
+
totalAmount: {
|
|
498
|
+
fontFamily: Fonts.outfitBold,
|
|
499
|
+
fontSize: moderateScale(20),
|
|
500
|
+
color: theme.colors.appleGreen,
|
|
501
|
+
},
|
|
502
|
+
inputContainer: {
|
|
503
|
+
marginBottom: theme.spacing.lg,
|
|
504
|
+
},
|
|
505
|
+
input: {
|
|
506
|
+
backgroundColor: theme.colors.background,
|
|
507
|
+
borderRadius: theme.borderRadius.xxl,
|
|
508
|
+
borderWidth: 1,
|
|
509
|
+
borderColor: theme.colors.border,
|
|
510
|
+
paddingHorizontal: theme.spacing.md,
|
|
511
|
+
paddingVertical: theme.spacing.md,
|
|
512
|
+
fontFamily: Fonts.outfitRegular,
|
|
513
|
+
fontSize: moderateScale(14),
|
|
514
|
+
color: theme.colors.text,
|
|
515
|
+
textAlign: 'center',
|
|
516
|
+
},
|
|
517
|
+
inputError: {
|
|
518
|
+
borderColor: theme.colors.error,
|
|
519
|
+
},
|
|
520
|
+
errorText: {
|
|
521
|
+
color: theme.colors.error,
|
|
522
|
+
fontSize: moderateScale(12),
|
|
523
|
+
fontFamily: Fonts.outfitRegular,
|
|
524
|
+
marginTop: theme.spacing.xs,
|
|
525
|
+
textAlign: 'center',
|
|
526
|
+
},
|
|
527
|
+
placeOrderButton: {
|
|
528
|
+
backgroundColor: theme.colors.blue,
|
|
529
|
+
borderRadius: moderateScale(25),
|
|
530
|
+
paddingVertical: moderateScale(16),
|
|
531
|
+
alignItems: 'center',
|
|
532
|
+
justifyContent: 'center',
|
|
533
|
+
flexDirection: 'row',
|
|
534
|
+
marginBottom: theme.spacing.md,
|
|
535
|
+
},
|
|
536
|
+
placeOrderButtonDisabled: {
|
|
537
|
+
backgroundColor: theme.colors.textSecondary,
|
|
538
|
+
opacity: 0.7,
|
|
539
|
+
},
|
|
540
|
+
placeOrderButtonText: {
|
|
541
|
+
fontFamily: Fonts.outfitBold,
|
|
542
|
+
fontSize: moderateScale(16),
|
|
543
|
+
color: theme.colors.white,
|
|
544
|
+
},
|
|
545
|
+
paymentMethodsContainer: {
|
|
546
|
+
flexDirection: 'row',
|
|
547
|
+
alignItems: 'center',
|
|
548
|
+
justifyContent: 'center',
|
|
549
|
+
gap: moderateScale(12),
|
|
550
|
+
paddingVertical: theme.spacing.sm,
|
|
551
|
+
},
|
|
552
|
+
paymentMethodsText: {
|
|
553
|
+
fontSize: moderateScale(13),
|
|
554
|
+
color: '#666',
|
|
555
|
+
fontFamily: Fonts.outfitRegular,
|
|
556
|
+
},
|
|
557
|
+
loaderOverlay: {
|
|
558
|
+
position: 'absolute',
|
|
559
|
+
top: 0,
|
|
560
|
+
left: 0,
|
|
561
|
+
right: 0,
|
|
562
|
+
bottom: 0,
|
|
563
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
564
|
+
justifyContent: 'center',
|
|
565
|
+
alignItems: 'center',
|
|
566
|
+
zIndex: 9999,
|
|
567
|
+
},
|
|
568
|
+
});
|