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,173 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
TouchableOpacity,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
ActivityIndicator,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
TextStyle,
|
|
9
|
+
View,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { theme } from '../../constants';
|
|
12
|
+
import { moderateScale } from '../../utils/scaling';
|
|
13
|
+
|
|
14
|
+
interface ButtonProps {
|
|
15
|
+
title: string;
|
|
16
|
+
onPress: () => void;
|
|
17
|
+
variant?: 'primary' | 'secondary' | 'outline';
|
|
18
|
+
size?: 'small' | 'medium' | 'large';
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
style?: ViewStyle;
|
|
22
|
+
textStyle?: TextStyle;
|
|
23
|
+
testID?: string;
|
|
24
|
+
leftIcon?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Button: React.FC<ButtonProps> = ({
|
|
28
|
+
title,
|
|
29
|
+
onPress,
|
|
30
|
+
variant = 'primary',
|
|
31
|
+
size = 'medium',
|
|
32
|
+
disabled = false,
|
|
33
|
+
loading = false,
|
|
34
|
+
style,
|
|
35
|
+
textStyle,
|
|
36
|
+
testID,
|
|
37
|
+
leftIcon,
|
|
38
|
+
}) => {
|
|
39
|
+
const buttonStyle = [
|
|
40
|
+
styles.base,
|
|
41
|
+
styles[variant],
|
|
42
|
+
styles[size],
|
|
43
|
+
disabled && styles.disabled,
|
|
44
|
+
style,
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const buttonTextStyle = [
|
|
48
|
+
styles.text,
|
|
49
|
+
styles[`${variant}Text`],
|
|
50
|
+
styles[`${size}Text`],
|
|
51
|
+
disabled && styles.disabledText,
|
|
52
|
+
textStyle,
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<TouchableOpacity
|
|
57
|
+
style={buttonStyle}
|
|
58
|
+
onPress={onPress}
|
|
59
|
+
disabled={disabled || loading}
|
|
60
|
+
testID={testID}
|
|
61
|
+
activeOpacity={0.8}
|
|
62
|
+
>
|
|
63
|
+
{loading ? (
|
|
64
|
+
<ActivityIndicator
|
|
65
|
+
color={variant === 'outline' ? theme.colors.primary : theme.colors.background}
|
|
66
|
+
size="small"
|
|
67
|
+
/>
|
|
68
|
+
) : (
|
|
69
|
+
<View style={styles.contentContainer}>
|
|
70
|
+
{leftIcon && <View style={styles.leftIconContainer}>{leftIcon}</View>}
|
|
71
|
+
<Text style={buttonTextStyle}>{title}</Text>
|
|
72
|
+
</View>
|
|
73
|
+
)}
|
|
74
|
+
</TouchableOpacity>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
base: {
|
|
80
|
+
borderRadius: theme.borderRadius.xxl,
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
borderWidth: 1.5,
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
flexDirection: 'row',
|
|
85
|
+
shadowColor: '#000',
|
|
86
|
+
shadowOffset: {
|
|
87
|
+
width: 0,
|
|
88
|
+
height: 2,
|
|
89
|
+
},
|
|
90
|
+
shadowOpacity: 0.1,
|
|
91
|
+
shadowRadius: 3,
|
|
92
|
+
elevation: 3,
|
|
93
|
+
},
|
|
94
|
+
// Variants
|
|
95
|
+
primary: {
|
|
96
|
+
backgroundColor: theme.colors.blue, // Blue-800
|
|
97
|
+
shadowColor: theme.colors.blue,
|
|
98
|
+
shadowOpacity: 0.3,
|
|
99
|
+
borderColor: theme.colors.blue,
|
|
100
|
+
},
|
|
101
|
+
secondary: {
|
|
102
|
+
backgroundColor: '#F9FAFB',
|
|
103
|
+
borderColor: '#E5E7EB',
|
|
104
|
+
shadowOpacity: 0.05,
|
|
105
|
+
},
|
|
106
|
+
outline: {
|
|
107
|
+
backgroundColor: 'transparent',
|
|
108
|
+
borderColor: theme.colors.appleGreen,
|
|
109
|
+
shadowOpacity: 0,
|
|
110
|
+
elevation: 0,
|
|
111
|
+
},
|
|
112
|
+
// Sizes
|
|
113
|
+
small: {
|
|
114
|
+
paddingHorizontal: theme.spacing.md,
|
|
115
|
+
paddingVertical: theme.spacing.xs,
|
|
116
|
+
minHeight: moderateScale(40),
|
|
117
|
+
},
|
|
118
|
+
medium: {
|
|
119
|
+
paddingHorizontal: theme.spacing.lg,
|
|
120
|
+
paddingVertical: theme.spacing.sm,
|
|
121
|
+
minHeight: moderateScale(50),
|
|
122
|
+
},
|
|
123
|
+
large: {
|
|
124
|
+
paddingHorizontal: theme.spacing.xl,
|
|
125
|
+
paddingVertical: theme.spacing.lg,
|
|
126
|
+
minHeight: moderateScale(60),
|
|
127
|
+
},
|
|
128
|
+
// Text styles
|
|
129
|
+
text: {
|
|
130
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
131
|
+
textAlign: 'center',
|
|
132
|
+
},
|
|
133
|
+
primaryText: {
|
|
134
|
+
color: theme.colors.white,
|
|
135
|
+
fontSize: theme.typography.fontSize.md,
|
|
136
|
+
},
|
|
137
|
+
secondaryText: {
|
|
138
|
+
color: theme.colors.text,
|
|
139
|
+
fontSize: theme.typography.fontSize.md,
|
|
140
|
+
},
|
|
141
|
+
outlineText: {
|
|
142
|
+
color: "red",
|
|
143
|
+
fontSize: theme.typography.fontSize.md,
|
|
144
|
+
},
|
|
145
|
+
smallText: {
|
|
146
|
+
fontSize: theme.typography.fontSize.sm,
|
|
147
|
+
},
|
|
148
|
+
mediumText: {
|
|
149
|
+
fontSize: theme.typography.fontSize.md,
|
|
150
|
+
},
|
|
151
|
+
largeText: {
|
|
152
|
+
fontSize: theme.typography.fontSize.lg,
|
|
153
|
+
},
|
|
154
|
+
// Disabled states
|
|
155
|
+
disabled: {
|
|
156
|
+
opacity: 0.5,
|
|
157
|
+
shadowOpacity: 0,
|
|
158
|
+
elevation: 0,
|
|
159
|
+
borderColor: theme.colors.border,
|
|
160
|
+
},
|
|
161
|
+
disabledText: {
|
|
162
|
+
opacity: 0.7,
|
|
163
|
+
},
|
|
164
|
+
// Icon container styles
|
|
165
|
+
contentContainer: {
|
|
166
|
+
flexDirection: 'row',
|
|
167
|
+
alignItems: 'center',
|
|
168
|
+
justifyContent: 'center',
|
|
169
|
+
},
|
|
170
|
+
leftIconContainer: {
|
|
171
|
+
marginRight: theme.spacing.xs,
|
|
172
|
+
},
|
|
173
|
+
});
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, Text, Image, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { theme } from '../../constants';
|
|
4
|
+
import { moderateScale } from '../../utils/scaling';
|
|
5
|
+
import { Fonts } from '../../constants/Fonts';
|
|
6
|
+
import SVG from '../../assets/icons';
|
|
7
|
+
import Images from '../../assets/images';
|
|
8
|
+
|
|
9
|
+
interface ClubCardProps {
|
|
10
|
+
club: {
|
|
11
|
+
id?: string | number;
|
|
12
|
+
name?: string;
|
|
13
|
+
clubName?: string;
|
|
14
|
+
clubImageUrl?: string;
|
|
15
|
+
profileImage?: string;
|
|
16
|
+
logo?: string;
|
|
17
|
+
members?: number;
|
|
18
|
+
address?: string;
|
|
19
|
+
location?: string;
|
|
20
|
+
clubCode?: string;
|
|
21
|
+
color?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
clubAddress?: string;
|
|
24
|
+
onJoinPress?: () => void;
|
|
25
|
+
onChatPress?: () => void;
|
|
26
|
+
onJoin?: boolean;
|
|
27
|
+
onChat?: boolean;
|
|
28
|
+
totalMembers?: number;
|
|
29
|
+
clubImage?: string;
|
|
30
|
+
};
|
|
31
|
+
onPress?: () => void;
|
|
32
|
+
onJoinPress?: () => void;
|
|
33
|
+
onChatPress?: () => void;
|
|
34
|
+
onJoin?: boolean;
|
|
35
|
+
onChat?: boolean;
|
|
36
|
+
clubCodeShow?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const ClubCard: React.FC<ClubCardProps> = ({
|
|
40
|
+
club,
|
|
41
|
+
onPress,
|
|
42
|
+
onJoinPress,
|
|
43
|
+
onChatPress,
|
|
44
|
+
onJoin,
|
|
45
|
+
onChat,
|
|
46
|
+
clubCodeShow
|
|
47
|
+
}) => {
|
|
48
|
+
const [imageError, setImageError] = useState(false);
|
|
49
|
+
const clubName = club?.name || club?.clubName || 'Unnamed Club';
|
|
50
|
+
const clubImage = club?.clubImage || club?.profileImage || club?.logo;
|
|
51
|
+
const memberCount = club?.members || club?.totalMembers || 0;
|
|
52
|
+
const address = club?.address || club?.location || '';
|
|
53
|
+
const clubCode = club?.clubCode || '';
|
|
54
|
+
const clubAddress = club?.clubAddress || '';
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<TouchableOpacity style={styles.card} onPress={onPress} activeOpacity={0.8}>
|
|
58
|
+
<View style={styles.logoContainer}>
|
|
59
|
+
{clubImage && !imageError ? (
|
|
60
|
+
<Image source={{ uri: clubImage }} style={styles.logo}
|
|
61
|
+
onError={() => {
|
|
62
|
+
setImageError(true);
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
) : (
|
|
67
|
+
<View style={[styles.placeholderLogo]}>
|
|
68
|
+
<Image source={Images.clubDefauldImage} style={styles.logo} />
|
|
69
|
+
</View>
|
|
70
|
+
)}
|
|
71
|
+
{imageError && (
|
|
72
|
+
<View style={styles.placeholderLogo}>
|
|
73
|
+
<Image source={Images.clubDefauldImage} style={styles.logo} />
|
|
74
|
+
</View>
|
|
75
|
+
)}
|
|
76
|
+
</View>
|
|
77
|
+
|
|
78
|
+
{/* Club Information */}
|
|
79
|
+
<View style={styles.infoContainer}>
|
|
80
|
+
{/* Club Name */}
|
|
81
|
+
<Text style={styles.clubName} numberOfLines={1}>
|
|
82
|
+
{clubName}
|
|
83
|
+
</Text>
|
|
84
|
+
|
|
85
|
+
{/* Members Count */}
|
|
86
|
+
<View style={styles.membersRow}>
|
|
87
|
+
<View style={styles.membersIcon}>
|
|
88
|
+
<SVG.UsersIcon width={moderateScale(16)} height={moderateScale(16)} />
|
|
89
|
+
</View>
|
|
90
|
+
<Text style={styles.membersText}>
|
|
91
|
+
{memberCount > 0 ? memberCount : 'No'} {memberCount <= 1 ? 'member' : 'members'}
|
|
92
|
+
</Text>
|
|
93
|
+
|
|
94
|
+
<View style={styles.clubCodeContainer}>
|
|
95
|
+
{onChat ? (
|
|
96
|
+
<TouchableOpacity hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
97
|
+
style={[styles.clubCodeText, { width: moderateScale(50), height: moderateScale(25), alignItems: 'center', justifyContent: 'center', borderWidth: 1, borderColor: theme.colors.appleGreen, borderRadius: theme.borderRadius.xl, backgroundColor: theme.colors.background }]}
|
|
98
|
+
onPress={onChatPress}>
|
|
99
|
+
<Text style={{ fontFamily: Fonts.outfitSemiBold, fontSize: theme.typography.fontSize.xs, color: theme.colors.appleGreen }}>Chat</Text>
|
|
100
|
+
</TouchableOpacity>
|
|
101
|
+
) : clubCodeShow ? (
|
|
102
|
+
<Text style={styles.clubCodeText}>
|
|
103
|
+
{clubCode}
|
|
104
|
+
</Text>
|
|
105
|
+
) : null}
|
|
106
|
+
</View>
|
|
107
|
+
</View>
|
|
108
|
+
|
|
109
|
+
{/* Address */}
|
|
110
|
+
{clubAddress != "" && (
|
|
111
|
+
<View style={styles.addressRow}>
|
|
112
|
+
<SVG.locationIcon width={moderateScale(16)} height={moderateScale(16)} />
|
|
113
|
+
<Text style={styles.addressText} numberOfLines={1}>
|
|
114
|
+
{clubAddress}
|
|
115
|
+
</Text>
|
|
116
|
+
</View>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{onJoin && (
|
|
120
|
+
<TouchableOpacity hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
121
|
+
style={[styles.clubCodeText, { marginTop: theme.spacing.sm, alignSelf: 'flex-start', width: moderateScale(50), height: moderateScale(25), alignItems: 'center', justifyContent: 'center', borderWidth: 1, borderColor: theme.colors.appleGreen, borderRadius: theme.borderRadius.xl, backgroundColor: theme.colors.background }]}
|
|
122
|
+
onPress={onJoinPress}>
|
|
123
|
+
<Text style={{ fontFamily: Fonts.outfitSemiBold, fontSize: theme.typography.fontSize.xs, color: theme.colors.appleGreen }}>Join</Text>
|
|
124
|
+
</TouchableOpacity>
|
|
125
|
+
)}
|
|
126
|
+
</View>
|
|
127
|
+
</TouchableOpacity>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const styles = StyleSheet.create({
|
|
132
|
+
card: {
|
|
133
|
+
flexDirection: 'row',
|
|
134
|
+
backgroundColor: theme.colors.lightLavenderGray,
|
|
135
|
+
borderRadius: theme.borderRadius.lg,
|
|
136
|
+
padding: theme.spacing.sm,
|
|
137
|
+
marginBottom: theme.spacing.sm,
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
},
|
|
140
|
+
logoContainer: {
|
|
141
|
+
width: moderateScale(70),
|
|
142
|
+
height: moderateScale(70),
|
|
143
|
+
borderRadius: theme.borderRadius.md,
|
|
144
|
+
marginRight: theme.spacing.sm,
|
|
145
|
+
overflow: 'hidden',
|
|
146
|
+
},
|
|
147
|
+
logo: {
|
|
148
|
+
width: '100%',
|
|
149
|
+
height: '100%',
|
|
150
|
+
borderRadius: theme.borderRadius.md,
|
|
151
|
+
},
|
|
152
|
+
placeholderLogo: {
|
|
153
|
+
width: '100%',
|
|
154
|
+
height: '100%',
|
|
155
|
+
borderWidth: 1,
|
|
156
|
+
borderColor: theme.colors.imageBorder,
|
|
157
|
+
backgroundColor: theme.colors.background,
|
|
158
|
+
borderRadius: theme.borderRadius.md,
|
|
159
|
+
justifyContent: 'center',
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
},
|
|
162
|
+
placeholderText: {
|
|
163
|
+
fontSize: moderateScale(24),
|
|
164
|
+
fontFamily: Fonts.outfitBold,
|
|
165
|
+
color: theme.colors.white,
|
|
166
|
+
},
|
|
167
|
+
infoContainer: {
|
|
168
|
+
flex: 1,
|
|
169
|
+
justifyContent: 'center',
|
|
170
|
+
},
|
|
171
|
+
clubName: {
|
|
172
|
+
fontSize: theme.typography.fontSize.md,
|
|
173
|
+
fontFamily: Fonts.outfitSemiBold,
|
|
174
|
+
color: theme.colors.text,
|
|
175
|
+
},
|
|
176
|
+
membersRow: {
|
|
177
|
+
flexDirection: 'row',
|
|
178
|
+
alignItems: 'center',
|
|
179
|
+
marginVertical: moderateScale(6),
|
|
180
|
+
},
|
|
181
|
+
membersIcon: {
|
|
182
|
+
marginRight: moderateScale(6),
|
|
183
|
+
},
|
|
184
|
+
membersIconText: {
|
|
185
|
+
fontSize: moderateScale(14),
|
|
186
|
+
},
|
|
187
|
+
membersText: {
|
|
188
|
+
fontSize: theme.typography.fontSize.xs,
|
|
189
|
+
fontFamily: Fonts.outfitLight,
|
|
190
|
+
color: theme.colors.primary,
|
|
191
|
+
},
|
|
192
|
+
clubCodeText: {
|
|
193
|
+
fontSize: theme.typography.fontSize.xs,
|
|
194
|
+
fontFamily: Fonts.outfitLight,
|
|
195
|
+
color: theme.colors.appleGreen,
|
|
196
|
+
alignSelf: 'flex-end',
|
|
197
|
+
marginRight: moderateScale(8),
|
|
198
|
+
},
|
|
199
|
+
clubCodeContainer: {
|
|
200
|
+
// width: moderateScale(150),
|
|
201
|
+
flex: 1,
|
|
202
|
+
alignSelf: 'flex-end',
|
|
203
|
+
},
|
|
204
|
+
colorIndicator: {
|
|
205
|
+
width: moderateScale(12),
|
|
206
|
+
height: moderateScale(12),
|
|
207
|
+
borderRadius: moderateScale(6),
|
|
208
|
+
marginLeft: moderateScale(8),
|
|
209
|
+
},
|
|
210
|
+
addressRow: {
|
|
211
|
+
flexDirection: 'row',
|
|
212
|
+
alignItems: 'center',
|
|
213
|
+
},
|
|
214
|
+
locationIcon: {
|
|
215
|
+
fontSize: moderateScale(12),
|
|
216
|
+
marginRight: moderateScale(6),
|
|
217
|
+
},
|
|
218
|
+
addressText: {
|
|
219
|
+
fontSize: theme.typography.fontSize.xs,
|
|
220
|
+
fontFamily: Fonts.outfitLight,
|
|
221
|
+
color: theme.colors.text,
|
|
222
|
+
flex: 1,
|
|
223
|
+
marginLeft: moderateScale(8),
|
|
224
|
+
},
|
|
225
|
+
arrowContainer: {
|
|
226
|
+
marginLeft: theme.spacing.sm,
|
|
227
|
+
justifyContent: 'center',
|
|
228
|
+
},
|
|
229
|
+
arrowText: {
|
|
230
|
+
fontSize: moderateScale(20),
|
|
231
|
+
fontFamily: Fonts.outfitBold,
|
|
232
|
+
color: theme.colors.textSecondary,
|
|
233
|
+
},
|
|
234
|
+
cancelButton: {
|
|
235
|
+
fontSize: theme.typography.fontSize.xs,
|
|
236
|
+
fontFamily: Fonts.outfitLight,
|
|
237
|
+
color: theme.colors.appleGreen,
|
|
238
|
+
alignSelf: 'flex-end',
|
|
239
|
+
marginRight: moderateScale(8),
|
|
240
|
+
},
|
|
241
|
+
cancelButtonText: {
|
|
242
|
+
fontFamily: Fonts.outfitSemiBold,
|
|
243
|
+
fontSize: theme.typography.fontSize.xs,
|
|
244
|
+
color: theme.colors.cancelButton,
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
export default ClubCard;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
3
|
+
import { SvgProps } from 'react-native-svg';
|
|
4
|
+
import { theme } from '../../constants';
|
|
5
|
+
|
|
6
|
+
// Try to import SVG icons with fallback
|
|
7
|
+
let HomeIcon: any, UserIcon: any, SettingsIcon: any, EyeIcon: any, EyeOffIcon: any;
|
|
8
|
+
let MailIcon: any, LockIcon: any, ChevronRightIcon: any, LogOutIcon: any, BellIcon: any;
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
HomeIcon = require('../../assets/icons/home.svg').default;
|
|
12
|
+
UserIcon = require('../../assets/icons/user.svg').default;
|
|
13
|
+
SettingsIcon = require('../../assets/icons/settings.svg').default;
|
|
14
|
+
EyeIcon = require('../../assets/icons/eye.svg').default;
|
|
15
|
+
EyeOffIcon = require('../../assets/icons/eye-off.svg').default;
|
|
16
|
+
MailIcon = require('../../assets/icons/mail.svg').default;
|
|
17
|
+
LockIcon = require('../../assets/icons/lock.svg').default;
|
|
18
|
+
ChevronRightIcon = require('../../assets/icons/chevron-right.svg').default;
|
|
19
|
+
LogOutIcon = require('../../assets/icons/log-out.svg').default;
|
|
20
|
+
BellIcon = require('../../assets/icons/bell.svg').default;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.warn('SVG icons could not be loaded, using fallback');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Icon mapping
|
|
26
|
+
const iconMap = {
|
|
27
|
+
home: HomeIcon,
|
|
28
|
+
user: UserIcon,
|
|
29
|
+
settings: SettingsIcon,
|
|
30
|
+
eye: EyeIcon,
|
|
31
|
+
'eye-off': EyeOffIcon,
|
|
32
|
+
mail: MailIcon,
|
|
33
|
+
lock: LockIcon,
|
|
34
|
+
'chevron-right': ChevronRightIcon,
|
|
35
|
+
'log-out': LogOutIcon,
|
|
36
|
+
bell: BellIcon,
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
export type IconName = keyof typeof iconMap;
|
|
40
|
+
|
|
41
|
+
export interface IconProps extends SvgProps {
|
|
42
|
+
name: IconName;
|
|
43
|
+
size?: number;
|
|
44
|
+
color?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Fallback icon component
|
|
48
|
+
const FallbackIcon: React.FC<{ name: string; size: number; color: string }> = ({ name, size, color }) => (
|
|
49
|
+
<View
|
|
50
|
+
style={{
|
|
51
|
+
width: size,
|
|
52
|
+
height: size,
|
|
53
|
+
backgroundColor: color,
|
|
54
|
+
borderRadius: size / 4,
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
justifyContent: 'center',
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<Text style={{ color: 'white', fontSize: size * 0.4, fontWeight: 'bold' }}>
|
|
60
|
+
{name.charAt(0).toUpperCase()}
|
|
61
|
+
</Text>
|
|
62
|
+
</View>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
export const Icon: React.FC<IconProps> = ({
|
|
66
|
+
name,
|
|
67
|
+
size = 24,
|
|
68
|
+
color = theme.colors.text,
|
|
69
|
+
...props
|
|
70
|
+
}) => {
|
|
71
|
+
const IconComponent = iconMap[name];
|
|
72
|
+
|
|
73
|
+
// Debug log to see what we're getting
|
|
74
|
+
if (__DEV__) {
|
|
75
|
+
console.log('Icon name:', name);
|
|
76
|
+
console.log('IconComponent:', IconComponent);
|
|
77
|
+
console.log('typeof IconComponent:', typeof IconComponent);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!IconComponent || typeof IconComponent !== 'function') {
|
|
81
|
+
console.warn(`Icon "${name}" not found or invalid, using fallback`);
|
|
82
|
+
return <FallbackIcon name={name} size={size} color={color} />;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<IconComponent
|
|
87
|
+
width={size}
|
|
88
|
+
height={size}
|
|
89
|
+
color={color}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import { theme } from '../../constants';
|
|
4
|
+
|
|
5
|
+
// Icon mapping using Unicode characters/emojis as fallback
|
|
6
|
+
const iconMap = {
|
|
7
|
+
home: '🏠',
|
|
8
|
+
user: '👤',
|
|
9
|
+
settings: '⚙️',
|
|
10
|
+
eye: '👁️',
|
|
11
|
+
'eye-off': '🙈',
|
|
12
|
+
mail: '📧',
|
|
13
|
+
lock: '🔒',
|
|
14
|
+
'chevron-right': '▶️',
|
|
15
|
+
'log-out': '🚪',
|
|
16
|
+
bell: '🔔',
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
export type IconName = keyof typeof iconMap;
|
|
20
|
+
|
|
21
|
+
export interface IconProps {
|
|
22
|
+
name: IconName;
|
|
23
|
+
size?: number;
|
|
24
|
+
color?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const IconAlt: React.FC<IconProps> = ({
|
|
28
|
+
name,
|
|
29
|
+
size = 24,
|
|
30
|
+
color = theme.colors.text,
|
|
31
|
+
}) => {
|
|
32
|
+
const iconCharacter = iconMap[name];
|
|
33
|
+
|
|
34
|
+
if (!iconCharacter) {
|
|
35
|
+
console.warn(`Icon "${name}" not found`);
|
|
36
|
+
return (
|
|
37
|
+
<View style={[styles.fallback, { width: size, height: size }]}>
|
|
38
|
+
<Text style={[styles.fallbackText, { fontSize: size * 0.6, color }]}>
|
|
39
|
+
?
|
|
40
|
+
</Text>
|
|
41
|
+
</View>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Text style={[styles.icon, { fontSize: size, color }]}>
|
|
47
|
+
{iconCharacter}
|
|
48
|
+
</Text>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const styles = StyleSheet.create({
|
|
53
|
+
icon: {
|
|
54
|
+
textAlign: 'center',
|
|
55
|
+
},
|
|
56
|
+
fallback: {
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
backgroundColor: theme.colors.surface,
|
|
60
|
+
borderRadius: 4,
|
|
61
|
+
},
|
|
62
|
+
fallbackText: {
|
|
63
|
+
fontWeight: 'bold',
|
|
64
|
+
},
|
|
65
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
TouchableOpacity,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
ViewStyle,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import { Icon, IconName, IconProps } from './Icon';
|
|
8
|
+
import { theme } from '../../constants';
|
|
9
|
+
|
|
10
|
+
interface IconButtonProps extends Omit<IconProps, 'name'> {
|
|
11
|
+
name: IconName;
|
|
12
|
+
onPress: () => void;
|
|
13
|
+
style?: ViewStyle;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
hitSlop?: number;
|
|
16
|
+
variant?: 'default' | 'filled' | 'outline';
|
|
17
|
+
size?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const IconButton: React.FC<IconButtonProps> = ({
|
|
21
|
+
name,
|
|
22
|
+
onPress,
|
|
23
|
+
style,
|
|
24
|
+
disabled = false,
|
|
25
|
+
hitSlop = 8,
|
|
26
|
+
variant = 'default',
|
|
27
|
+
size = 24,
|
|
28
|
+
color,
|
|
29
|
+
...iconProps
|
|
30
|
+
}) => {
|
|
31
|
+
const buttonStyle = [
|
|
32
|
+
styles.base,
|
|
33
|
+
styles[variant],
|
|
34
|
+
disabled && styles.disabled,
|
|
35
|
+
{ width: size + 16, height: size + 16 },
|
|
36
|
+
style,
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
const iconColor = color || getIconColor(variant, disabled);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<TouchableOpacity
|
|
43
|
+
style={buttonStyle}
|
|
44
|
+
onPress={onPress}
|
|
45
|
+
disabled={disabled}
|
|
46
|
+
hitSlop={{ top: hitSlop, bottom: hitSlop, left: hitSlop, right: hitSlop }}
|
|
47
|
+
activeOpacity={0.7}
|
|
48
|
+
>
|
|
49
|
+
<Icon
|
|
50
|
+
name={name}
|
|
51
|
+
size={size}
|
|
52
|
+
color={iconColor}
|
|
53
|
+
{...iconProps}
|
|
54
|
+
/>
|
|
55
|
+
</TouchableOpacity>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const getIconColor = (variant: string, disabled: boolean): string => {
|
|
60
|
+
if (disabled) return theme.colors.textSecondary;
|
|
61
|
+
|
|
62
|
+
switch (variant) {
|
|
63
|
+
case 'filled':
|
|
64
|
+
return theme.colors.background;
|
|
65
|
+
case 'outline':
|
|
66
|
+
return theme.colors.primary;
|
|
67
|
+
default:
|
|
68
|
+
return theme.colors.text;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const styles = StyleSheet.create({
|
|
73
|
+
base: {
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
borderRadius: theme.borderRadius.md,
|
|
77
|
+
},
|
|
78
|
+
default: {
|
|
79
|
+
backgroundColor: 'transparent',
|
|
80
|
+
},
|
|
81
|
+
filled: {
|
|
82
|
+
backgroundColor: theme.colors.primary,
|
|
83
|
+
},
|
|
84
|
+
outline: {
|
|
85
|
+
backgroundColor: 'transparent',
|
|
86
|
+
borderWidth: 1,
|
|
87
|
+
borderColor: theme.colors.primary,
|
|
88
|
+
},
|
|
89
|
+
disabled: {
|
|
90
|
+
opacity: 0.5,
|
|
91
|
+
},
|
|
92
|
+
});
|