@varunindiit/create-rn-starter 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +93 -0
  3. package/bin/index.js +270 -0
  4. package/lib/prompt.js +63 -0
  5. package/lib/rename.js +239 -0
  6. package/lib/scaffold.js +110 -0
  7. package/lib/utils.js +122 -0
  8. package/package.json +38 -0
  9. package/template/.eslintrc.js +4 -0
  10. package/template/.prettierrc.js +5 -0
  11. package/template/.watchmanconfig +1 -0
  12. package/template/App.tsx +100 -0
  13. package/template/Gemfile +17 -0
  14. package/template/README.md +97 -0
  15. package/template/__tests__/App.test.tsx +13 -0
  16. package/template/_gitignore +75 -0
  17. package/template/android/app/build.gradle +119 -0
  18. package/template/android/app/debug.keystore +0 -0
  19. package/template/android/app/proguard-rules.pro +10 -0
  20. package/template/android/app/src/main/AndroidManifest.xml +45 -0
  21. package/template/android/app/src/main/assets/fonts/MonaSans-Black.ttf +0 -0
  22. package/template/android/app/src/main/assets/fonts/MonaSans-BlackItalic.ttf +0 -0
  23. package/template/android/app/src/main/assets/fonts/MonaSans-Bold.ttf +0 -0
  24. package/template/android/app/src/main/assets/fonts/MonaSans-BoldItalic.ttf +0 -0
  25. package/template/android/app/src/main/assets/fonts/MonaSans-ExtraBold.ttf +0 -0
  26. package/template/android/app/src/main/assets/fonts/MonaSans-ExtraBoldItalic.ttf +0 -0
  27. package/template/android/app/src/main/assets/fonts/MonaSans-ExtraLight.ttf +0 -0
  28. package/template/android/app/src/main/assets/fonts/MonaSans-ExtraLightItalic.ttf +0 -0
  29. package/template/android/app/src/main/assets/fonts/MonaSans-Italic.ttf +0 -0
  30. package/template/android/app/src/main/assets/fonts/MonaSans-Light.ttf +0 -0
  31. package/template/android/app/src/main/assets/fonts/MonaSans-LightItalic.ttf +0 -0
  32. package/template/android/app/src/main/assets/fonts/MonaSans-Medium.ttf +0 -0
  33. package/template/android/app/src/main/assets/fonts/MonaSans-MediumItalic.ttf +0 -0
  34. package/template/android/app/src/main/assets/fonts/MonaSans-Regular.ttf +0 -0
  35. package/template/android/app/src/main/assets/fonts/MonaSans-SemiBold.ttf +0 -0
  36. package/template/android/app/src/main/assets/fonts/MonaSans-SemiBoldItalic.ttf +0 -0
  37. package/template/android/app/src/main/java/com/awesomeproject/MainActivity.kt +22 -0
  38. package/template/android/app/src/main/java/com/awesomeproject/MainApplication.kt +27 -0
  39. package/template/android/app/src/main/res/drawable/launch_screen.png +0 -0
  40. package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  41. package/template/android/app/src/main/res/layout/launch_screen.xml +12 -0
  42. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  43. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  44. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  45. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  46. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  47. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  48. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  49. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  50. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  51. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  52. package/template/android/app/src/main/res/values/colors.xml +3 -0
  53. package/template/android/app/src/main/res/values/strings.xml +3 -0
  54. package/template/android/app/src/main/res/values/styles.xml +11 -0
  55. package/template/android/build.gradle +21 -0
  56. package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  57. package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  58. package/template/android/gradle.properties +44 -0
  59. package/template/android/gradlew +248 -0
  60. package/template/android/gradlew.bat +98 -0
  61. package/template/android/link-assets-manifest.json +69 -0
  62. package/template/android/settings.gradle +6 -0
  63. package/template/app.json +4 -0
  64. package/template/babel.config.js +4 -0
  65. package/template/declarations.d.ts +6 -0
  66. package/template/env.example +20 -0
  67. package/template/index.js +10 -0
  68. package/template/ios/.xcode.env +11 -0
  69. package/template/ios/.xcode.env.local +1 -0
  70. package/template/ios/AwesomeProject/AppDelegate.swift +60 -0
  71. package/template/ios/AwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  72. package/template/ios/AwesomeProject/Images.xcassets/Contents.json +6 -0
  73. package/template/ios/AwesomeProject/Images.xcassets/Splash.imageset/Contents.json +23 -0
  74. package/template/ios/AwesomeProject/Images.xcassets/Splash.imageset/Splash@1x.png +0 -0
  75. package/template/ios/AwesomeProject/Images.xcassets/Splash.imageset/Splash@2x.png +0 -0
  76. package/template/ios/AwesomeProject/Images.xcassets/Splash.imageset/Splash@3x.png +0 -0
  77. package/template/ios/AwesomeProject/Info.plist +89 -0
  78. package/template/ios/AwesomeProject/LaunchScreen.storyboard +40 -0
  79. package/template/ios/AwesomeProject/PrivacyInfo.xcprivacy +38 -0
  80. package/template/ios/AwesomeProject.xcodeproj/project.pbxproj +576 -0
  81. package/template/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme +88 -0
  82. package/template/ios/AwesomeProject.xcworkspace/contents.xcworkspacedata +10 -0
  83. package/template/ios/Podfile +68 -0
  84. package/template/ios/link-assets-manifest.json +69 -0
  85. package/template/jest.config.js +3 -0
  86. package/template/metro.config.js +24 -0
  87. package/template/package.json +68 -0
  88. package/template/react-native.config.js +7 -0
  89. package/template/src/assets/fonts/MonaSans-Black.ttf +0 -0
  90. package/template/src/assets/fonts/MonaSans-BlackItalic.ttf +0 -0
  91. package/template/src/assets/fonts/MonaSans-Bold.ttf +0 -0
  92. package/template/src/assets/fonts/MonaSans-BoldItalic.ttf +0 -0
  93. package/template/src/assets/fonts/MonaSans-ExtraBold.ttf +0 -0
  94. package/template/src/assets/fonts/MonaSans-ExtraBoldItalic.ttf +0 -0
  95. package/template/src/assets/fonts/MonaSans-ExtraLight.ttf +0 -0
  96. package/template/src/assets/fonts/MonaSans-ExtraLightItalic.ttf +0 -0
  97. package/template/src/assets/fonts/MonaSans-Italic.ttf +0 -0
  98. package/template/src/assets/fonts/MonaSans-Light.ttf +0 -0
  99. package/template/src/assets/fonts/MonaSans-LightItalic.ttf +0 -0
  100. package/template/src/assets/fonts/MonaSans-Medium.ttf +0 -0
  101. package/template/src/assets/fonts/MonaSans-MediumItalic.ttf +0 -0
  102. package/template/src/assets/fonts/MonaSans-Regular.ttf +0 -0
  103. package/template/src/assets/fonts/MonaSans-SemiBold.ttf +0 -0
  104. package/template/src/assets/fonts/MonaSans-SemiBoldItalic.ttf +0 -0
  105. package/template/src/assets/image/BackGroundAuth.png +0 -0
  106. package/template/src/assets/image/BackgroundVerification.png +0 -0
  107. package/template/src/assets/image/logo.png +0 -0
  108. package/template/src/assets/svg/add-circle.svg +5 -0
  109. package/template/src/assets/svg/airConditioning.svg +12 -0
  110. package/template/src/assets/svg/apple.svg +3 -0
  111. package/template/src/assets/svg/arrowDown.svg +3 -0
  112. package/template/src/assets/svg/back.svg +10 -0
  113. package/template/src/assets/svg/bag.svg +11 -0
  114. package/template/src/assets/svg/calender.svg +5 -0
  115. package/template/src/assets/svg/car.svg +10 -0
  116. package/template/src/assets/svg/carConfirm.svg +60 -0
  117. package/template/src/assets/svg/chatActive.svg +3 -0
  118. package/template/src/assets/svg/chatUnActive.svg +3 -0
  119. package/template/src/assets/svg/document-text.svg +6 -0
  120. package/template/src/assets/svg/gender.svg +11 -0
  121. package/template/src/assets/svg/google.svg +6 -0
  122. package/template/src/assets/svg/headphone.svg +3 -0
  123. package/template/src/assets/svg/homeActive.svg +3 -0
  124. package/template/src/assets/svg/homeUnActive.svg +3 -0
  125. package/template/src/assets/svg/logo.svg +18 -0
  126. package/template/src/assets/svg/logout.svg +5 -0
  127. package/template/src/assets/svg/maxBack.svg +4 -0
  128. package/template/src/assets/svg/message-text.svg +7 -0
  129. package/template/src/assets/svg/music.svg +5 -0
  130. package/template/src/assets/svg/noSmoking.svg +10 -0
  131. package/template/src/assets/svg/notification.svg +5 -0
  132. package/template/src/assets/svg/passenger.svg +4 -0
  133. package/template/src/assets/svg/phone.svg +3 -0
  134. package/template/src/assets/svg/rightArrow.svg +3 -0
  135. package/template/src/assets/svg/security-user.svg +5 -0
  136. package/template/src/assets/svg/star.svg +3 -0
  137. package/template/src/assets/svg/tick-circle.svg +4 -0
  138. package/template/src/assets/svg/trafficLight.svg +41 -0
  139. package/template/src/assets/svg/tripActive.svg +10 -0
  140. package/template/src/assets/svg/tripUnActive.svg +10 -0
  141. package/template/src/assets/svg/usbChargers.svg +3 -0
  142. package/template/src/assets/svg/user.svg +4 -0
  143. package/template/src/assets/svg/userActive.svg +3 -0
  144. package/template/src/assets/svg/userPlaceholder.svg +3 -0
  145. package/template/src/assets/svg/userUnActive.svg +3 -0
  146. package/template/src/components/AuthLayout/AuthLayout.tsx +170 -0
  147. package/template/src/components/AuthLayout/index.ts +1 -0
  148. package/template/src/components/BottomSheet/BottomSheet.tsx +73 -0
  149. package/template/src/components/BottomSheet/BottomSheetAlert.tsx +100 -0
  150. package/template/src/components/BottomSheet/CenterAlert.tsx +153 -0
  151. package/template/src/components/BottomSheet/index.ts +2 -0
  152. package/template/src/components/BottomTabBar/index.tsx +145 -0
  153. package/template/src/components/Button/RNButton.tsx +152 -0
  154. package/template/src/components/Button/index.ts +2 -0
  155. package/template/src/components/Common/Avatar.tsx +80 -0
  156. package/template/src/components/Common/Card.tsx +49 -0
  157. package/template/src/components/Common/CardBrandLogo.tsx +66 -0
  158. package/template/src/components/Common/Checkbox.tsx +65 -0
  159. package/template/src/components/Common/Chip.tsx +79 -0
  160. package/template/src/components/Common/CommonStyles.tsx +594 -0
  161. package/template/src/components/Common/Divider.tsx +33 -0
  162. package/template/src/components/Common/DriverTripCard.tsx +308 -0
  163. package/template/src/components/Common/Dropdown.tsx +161 -0
  164. package/template/src/components/Common/EmptyState.tsx +52 -0
  165. package/template/src/components/Common/FAB.tsx +68 -0
  166. package/template/src/components/Common/HeaderLocation.tsx +108 -0
  167. package/template/src/components/Common/Loader.tsx +23 -0
  168. package/template/src/components/Common/RatingStars.tsx +103 -0
  169. package/template/src/components/Common/RouteDots.tsx +98 -0
  170. package/template/src/components/Common/SegmentedControl.tsx +126 -0
  171. package/template/src/components/Common/SosButton.tsx +80 -0
  172. package/template/src/components/Common/SosSheet.tsx +344 -0
  173. package/template/src/components/Common/StarRating.tsx +58 -0
  174. package/template/src/components/Common/StatusBadge.tsx +56 -0
  175. package/template/src/components/Common/Toggle.tsx +66 -0
  176. package/template/src/components/Common/TripCard.tsx +247 -0
  177. package/template/src/components/Common/UploadBox.tsx +106 -0
  178. package/template/src/components/Container/MainContainer.tsx +76 -0
  179. package/template/src/components/Container/index.ts +1 -0
  180. package/template/src/components/Header/index.tsx +143 -0
  181. package/template/src/components/Icon/SvgIcons.tsx +1991 -0
  182. package/template/src/components/ImagePickerSheet/ImagePickerSheet.tsx +233 -0
  183. package/template/src/components/ImagePickerSheet/index.ts +2 -0
  184. package/template/src/components/Input/CountryDropdown.tsx +71 -0
  185. package/template/src/components/Input/OtpInput.tsx +117 -0
  186. package/template/src/components/Input/RNInput.tsx +138 -0
  187. package/template/src/components/Input/index.ts +4 -0
  188. package/template/src/components/Picker/DatePickerSheet.tsx +393 -0
  189. package/template/src/components/Picker/PassengerPickerSheet.tsx +237 -0
  190. package/template/src/components/Text/RNText.tsx +62 -0
  191. package/template/src/components/Text/index.ts +1 -0
  192. package/template/src/components/index.ts +44 -0
  193. package/template/src/hooks/useCurrentLocation.ts +72 -0
  194. package/template/src/localization/i18n.ts +29 -0
  195. package/template/src/localization/i18next.d.ts +11 -0
  196. package/template/src/localization/index.ts +4 -0
  197. package/template/src/localization/languageStorage.ts +27 -0
  198. package/template/src/localization/languages.ts +62 -0
  199. package/template/src/localization/resources/en.ts +703 -0
  200. package/template/src/localization/resources/fr.ts +703 -0
  201. package/template/src/localization/useLanguage.ts +42 -0
  202. package/template/src/navigation/AuthNavigation.tsx +23 -0
  203. package/template/src/navigation/BottomTabs.tsx +24 -0
  204. package/template/src/navigation/RootNavigation.tsx +27 -0
  205. package/template/src/navigation/RouteKey.ts +22 -0
  206. package/template/src/navigation/StackNavigation.tsx +52 -0
  207. package/template/src/navigation/paramLists.ts +25 -0
  208. package/template/src/redux/slice/app.ts +66 -0
  209. package/template/src/redux/slice/auth.ts +40 -0
  210. package/template/src/redux/slice/userProfile.ts +124 -0
  211. package/template/src/redux/store.ts +17 -0
  212. package/template/src/screen/auth/Login.tsx +69 -0
  213. package/template/src/screen/onboarding/LanguageSelection.tsx +231 -0
  214. package/template/src/screen/root/home/index.tsx +36 -0
  215. package/template/src/screen/root/profile/index.tsx +69 -0
  216. package/template/src/screen/shared/Chat.tsx +308 -0
  217. package/template/src/screen/shared/EditProfile.tsx +407 -0
  218. package/template/src/screen/shared/HelpSupport.tsx +678 -0
  219. package/template/src/screen/shared/LocationSearch.tsx +362 -0
  220. package/template/src/screen/shared/Messages.tsx +115 -0
  221. package/template/src/screen/shared/Notifications.tsx +86 -0
  222. package/template/src/screen/shared/PrivacyPolicy.tsx +297 -0
  223. package/template/src/screen/shared/Profile.tsx +118 -0
  224. package/template/src/screen/shared/Ratings.tsx +170 -0
  225. package/template/src/screen/shared/TermsConditions.tsx +315 -0
  226. package/template/src/screen/shared/profile/DriverProfile.tsx +262 -0
  227. package/template/src/screen/shared/profile/PassengerProfile.tsx +123 -0
  228. package/template/src/screen/shared/profile/ProfileParts.tsx +219 -0
  229. package/template/src/services/Config.ts +37 -0
  230. package/template/src/services/api.ts +37 -0
  231. package/template/src/services/index.ts +4 -0
  232. package/template/src/services/places.ts +320 -0
  233. package/template/src/services/storage.ts +33 -0
  234. package/template/src/theme/fonts.ts +30 -0
  235. package/template/src/theme/index.ts +3 -0
  236. package/template/src/theme/spacing.ts +66 -0
  237. package/template/src/theme/theme.ts +58 -0
  238. package/template/src/types/env.d.ts +8 -0
  239. package/template/src/types/index.ts +3 -0
  240. package/template/src/utils/card.ts +101 -0
  241. package/template/src/utils/constants.ts +39 -0
  242. package/template/src/utils/functions.ts +24 -0
  243. package/template/tsconfig.json +8 -0
@@ -0,0 +1,66 @@
1
+ import { Dimensions } from "react-native";
2
+ import { moderateScale, scale, verticalScale } from "react-native-size-matters";
3
+
4
+ const { width, height } = Dimensions.get("window");
5
+
6
+ export const SCREEN = { width, height };
7
+
8
+ /** Margin / padding scale */
9
+ export const SPACING = {
10
+ xxs: moderateScale(2),
11
+ xs: moderateScale(4),
12
+ sm: moderateScale(8),
13
+ md: moderateScale(12),
14
+ base: moderateScale(14),
15
+ lg: moderateScale(16),
16
+ xl: moderateScale(20),
17
+ xxl: moderateScale(24),
18
+ xxxl: moderateScale(32),
19
+ huge: moderateScale(40),
20
+
21
+ hPadding: scale(20),
22
+ vPadding: verticalScale(20),
23
+
24
+ radiusXs: moderateScale(4),
25
+ radiusSm: moderateScale(8),
26
+ radiusMd: moderateScale(12),
27
+ radiusLg: moderateScale(16),
28
+ radiusXl: moderateScale(20),
29
+ radiusXxl: moderateScale(28),
30
+ radiusPill: moderateScale(999),
31
+ };
32
+
33
+ export const SIZES = {
34
+ buttonHeight: moderateScale(52),
35
+ buttonHeightSm: moderateScale(40),
36
+ inputHeight: moderateScale(54),
37
+ iconXs: moderateScale(12),
38
+ iconSm: moderateScale(14),
39
+ iconMd: moderateScale(18),
40
+ iconLg: moderateScale(22),
41
+ iconXl: moderateScale(28),
42
+ iconXxl: moderateScale(34),
43
+ avatarSm: moderateScale(36),
44
+ avatar: moderateScale(48),
45
+ avatarLg: moderateScale(64),
46
+ circleBtn: moderateScale(40),
47
+ tabBarHeight: moderateScale(64),
48
+ headerHeight: moderateScale(50),
49
+ };
50
+
51
+ export const FONT_SIZE = {
52
+ xxs: moderateScale(10),
53
+ xs: moderateScale(11),
54
+ sm: moderateScale(12),
55
+ md: moderateScale(13),
56
+ base: moderateScale(14),
57
+ lg: moderateScale(15),
58
+ xl: moderateScale(16),
59
+ xxl: moderateScale(18),
60
+ h6: moderateScale(20),
61
+ h5: moderateScale(22),
62
+ h4: moderateScale(24),
63
+ h3: moderateScale(28),
64
+ h2: moderateScale(32),
65
+ h1: moderateScale(40),
66
+ };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * HD WAKA — design tokens
3
+ * Brand: warm orange on cream/peach. Cards are white with subtle shadows.
4
+ */
5
+ export const COLORS = {
6
+ // Brand
7
+ primary: "rgba(232, 124, 62, 1)",
8
+ primaryDark: "rgba(196, 82, 26, 1)",
9
+ primaryLight: "#FCE4D2",
10
+ primaryFaint: "#FFF3EA",
11
+
12
+ // Backgrounds
13
+ background: "#FBE9D6",
14
+ backgroundAlt: "#FFF6EC",
15
+ surface: "rgba(255, 251, 249, 1)",
16
+ surfaceMuted: "#FAF7F4",
17
+ overlay: "rgba(0,0,0,0.45)",
18
+ labelBrown: "rgba(122, 90, 58, 1)",
19
+
20
+ // Text
21
+ text: "rgba(44, 26, 14, 1)",
22
+ textSecondary: "#5C5C5C",
23
+ textMuted: "#9A9A9A",
24
+ textPlaceholder: "#BDBDBD",
25
+ textOnPrimary: "#FFFFFF",
26
+
27
+ // Borders / Lines
28
+ border: "#F2DDC8",
29
+ divider: "#F0EAE3",
30
+ inputBorder: "#EADFD2",
31
+
32
+ // Status
33
+ success: "#1FA971",
34
+ successLight: "#E7F8F0",
35
+ warning: "#F4B400",
36
+ warningLight: "#FFF6DA",
37
+ danger: "#E5484D",
38
+ dangerLight: "#FDECEC",
39
+ info: "#2D7FF9",
40
+
41
+ // Misc
42
+ star: "#F4B400",
43
+ unselectedStar: "#E5DAC9",
44
+ shadow: "rgba(28, 22, 14, 0.10)",
45
+ greenDot: "#1FA971",
46
+ redDot: "#E5484D",
47
+
48
+ // Tab bar
49
+ tabActive: "#F26B2A",
50
+ tabInactive: "#9A9A9A",
51
+ tabBg: "#FFFFFF",
52
+ };
53
+
54
+ export const THEME = {
55
+ ...COLORS,
56
+ };
57
+
58
+ export type ThemeType = typeof THEME;
@@ -0,0 +1,8 @@
1
+ declare module '@env' {
2
+ export const REACT_APP_ENV: string;
3
+ export const REACT_APP_VERSION: string;
4
+ export const REACT_APP_API: string;
5
+ export const REACT_APP_DOMAIN: string;
6
+ export const REACT_APP_SOCKET: string;
7
+ export const STRIPE_PUBLISHED_KEY: string;
8
+ }
@@ -0,0 +1,3 @@
1
+ export interface Identifiable {
2
+ id: string;
3
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Card helpers — brand detection, formatting and validation for the
3
+ * payment-method flow. Pure functions, no UI / native deps.
4
+ */
5
+
6
+ export type CardBrand =
7
+ | "visa"
8
+ | "mastercard"
9
+ | "amex"
10
+ | "discover"
11
+ | "card";
12
+
13
+ /** Human label for a brand, used as the card "type" in the UI. */
14
+ export const CARD_BRAND_LABEL: Record<CardBrand, string> = {
15
+ visa: "Visa",
16
+ mastercard: "Mastercard",
17
+ amex: "Amex",
18
+ discover: "Discover",
19
+ card: "Card",
20
+ };
21
+
22
+ /** Strip everything that is not a digit. */
23
+ export const onlyDigits = (value: string) => value.replace(/\D/g, "");
24
+
25
+ /** Detect the card brand from the (partial) card number. */
26
+ export const detectBrand = (rawNumber: string): CardBrand => {
27
+ const n = onlyDigits(rawNumber);
28
+ if (/^4/.test(n)) return "visa";
29
+ if (/^(5[1-5]|2[2-7])/.test(n)) return "mastercard";
30
+ if (/^3[47]/.test(n)) return "amex";
31
+ if (/^(6011|65|64[4-9])/.test(n)) return "discover";
32
+ return "card";
33
+ };
34
+
35
+ /** Amex uses 15 digits, everyone else 16. */
36
+ export const brandMaxDigits = (brand: CardBrand) =>
37
+ brand === "amex" ? 15 : 16;
38
+
39
+ /** CVV length per brand (Amex = 4). */
40
+ export const brandCvvLength = (brand: CardBrand) =>
41
+ brand === "amex" ? 4 : 3;
42
+
43
+ /**
44
+ * Format a card number with spaces for display / input.
45
+ * Amex groups as 4-6-5, all others as 4-4-4-4.
46
+ */
47
+ export const formatCardNumber = (rawNumber: string): string => {
48
+ const brand = detectBrand(rawNumber);
49
+ const digits = onlyDigits(rawNumber).slice(0, brandMaxDigits(brand));
50
+ const groups = brand === "amex" ? [4, 6, 5] : [4, 4, 4, 4];
51
+
52
+ const parts: string[] = [];
53
+ let index = 0;
54
+ for (const size of groups) {
55
+ if (index >= digits.length) break;
56
+ parts.push(digits.slice(index, index + size));
57
+ index += size;
58
+ }
59
+ return parts.join(" ");
60
+ };
61
+
62
+ /** Format expiry input into `MM/YY`. */
63
+ export const formatExpiry = (raw: string): string => {
64
+ const digits = onlyDigits(raw).slice(0, 4);
65
+ if (digits.length <= 2) return digits;
66
+ return `${digits.slice(0, 2)}/${digits.slice(2)}`;
67
+ };
68
+
69
+ /** Last 4 digits of a (possibly formatted) card number. */
70
+ export const lastFour = (rawNumber: string) =>
71
+ onlyDigits(rawNumber).slice(-4);
72
+
73
+ /** Luhn checksum — true when the number is structurally valid. */
74
+ export const isLuhnValid = (rawNumber: string): boolean => {
75
+ const digits = onlyDigits(rawNumber);
76
+ if (digits.length < 12) return false;
77
+ let sum = 0;
78
+ let double = false;
79
+ for (let i = digits.length - 1; i >= 0; i -= 1) {
80
+ let d = parseInt(digits[i], 10);
81
+ if (double) {
82
+ d *= 2;
83
+ if (d > 9) d -= 9;
84
+ }
85
+ sum += d;
86
+ double = !double;
87
+ }
88
+ return sum % 10 === 0;
89
+ };
90
+
91
+ /** Validate `MM/YY` — real month, not in the past. */
92
+ export const isExpiryValid = (expiry: string): boolean => {
93
+ const digits = onlyDigits(expiry);
94
+ if (digits.length !== 4) return false;
95
+ const month = parseInt(digits.slice(0, 2), 10);
96
+ const year = 2000 + parseInt(digits.slice(2), 10);
97
+ if (month < 1 || month > 12) return false;
98
+ const now = new Date();
99
+ const endOfMonth = new Date(year, month, 0, 23, 59, 59);
100
+ return endOfMonth >= now;
101
+ };
@@ -0,0 +1,39 @@
1
+ import { Dimensions } from "react-native";
2
+ import { moderateScale } from "react-native-size-matters";
3
+
4
+ const { width, height } = Dimensions.get("screen");
5
+
6
+ /** Persistence keys (MMKV) */
7
+ export const IS_LOGGED_IN = "isLoggedIn";
8
+ export const ROLE_KEY = "userRole";
9
+ export const TOKEN_KEY = "authToken";
10
+ export const REFRESH_TOKEN_KEY = "refreshToken";
11
+ export const LANGUAGE_KEY = "appLanguage";
12
+ export const LANGUAGE_SELECTED_KEY = "languageSelected";
13
+
14
+ export const SCREEN_DIM = {
15
+ width,
16
+ height,
17
+ paddingHorizontal: moderateScale(20),
18
+ };
19
+
20
+ export { FONTS } from "../theme/fonts";
21
+ export { THEME as COLORS } from "../theme/theme";
22
+
23
+ /** Static dropdown / picker data used across the app */
24
+ export const VEHICLE_BRANDS = [
25
+ "Toyota",
26
+ "Mercedes-Benz",
27
+ "Honda",
28
+ "Hyundai",
29
+ "Kia",
30
+ "Nissan",
31
+ "Suzuki",
32
+ "Peugeot",
33
+ ];
34
+
35
+ export const GENDERS = ["Male", "Female", "Other"] as const;
36
+
37
+ export const LUGGAGE = ["Small", "Medium", "Large"] as const;
38
+ export const MUSIC_LEVELS = ["Any", "No Music", "Low", "Mixed"] as const;
39
+ export const CONVERSATION_LEVELS = ["Quiet", "Depends", "Talkative"] as const;
@@ -0,0 +1,24 @@
1
+ import { showMessage, MessageType } from "react-native-flash-message";
2
+ import { FONTS } from "../theme";
3
+
4
+ export const showToast = (
5
+ message: string,
6
+ type: MessageType = "info",
7
+ duration: number = 2000,
8
+ ) => {
9
+ showMessage({
10
+ message,
11
+ type,
12
+ icon: type,
13
+ floating: true,
14
+ style: { alignItems: "center" },
15
+ duration,
16
+ titleStyle: { fontFamily: FONTS.medium, fontWeight: "500" },
17
+ });
18
+ };
19
+
20
+ export const pad2 = (n: number) => n.toString().padStart(2, "0");
21
+
22
+ /** Format a price like 4400 -> "4,400" */
23
+ export const formatNumber = (n?: number) =>
24
+ (n ?? 0).toLocaleString(undefined, { maximumFractionDigits: 0 });
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "@react-native/typescript-config",
3
+ "compilerOptions": {
4
+ "types": ["jest"]
5
+ },
6
+ "include": ["**/*.ts", "**/*.tsx"],
7
+ "exclude": ["**/node_modules", "**/Pods"]
8
+ }