create-react-native-starter-kit 0.0.0-stage → 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 (211) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +378 -2
  3. package/bin/create-react-native-starter-kit.js +95 -0
  4. package/lib/copy-src.js +127 -0
  5. package/lib/creator.js +211 -0
  6. package/lib/deps.js +58 -0
  7. package/lib/patch-configs.js +318 -0
  8. package/lib/patch-native.js +588 -0
  9. package/package.json +47 -4
  10. package/scripts/sync-template.js +52 -0
  11. package/template/.env.example +3 -0
  12. package/template/patches/react-native-element-dropdown+2.12.4.patch +67 -0
  13. package/template/src/app/App.tsx +25 -0
  14. package/template/src/app/navigation/root.tsx +24 -0
  15. package/template/src/app/navigation/stacks/app.stack.tsx +67 -0
  16. package/template/src/app/navigation/stacks/app.tab.tsx +72 -0
  17. package/template/src/app/navigation/stacks/auth.stack.tsx +56 -0
  18. package/template/src/app/providers.tsx +43 -0
  19. package/template/src/assets/fonts/InterTight-Black.ttf +0 -0
  20. package/template/src/assets/fonts/InterTight-BlackItalic.ttf +0 -0
  21. package/template/src/assets/fonts/InterTight-Bold.ttf +0 -0
  22. package/template/src/assets/fonts/InterTight-BoldItalic.ttf +0 -0
  23. package/template/src/assets/fonts/InterTight-ExtraBold.ttf +0 -0
  24. package/template/src/assets/fonts/InterTight-ExtraBoldItalic.ttf +0 -0
  25. package/template/src/assets/fonts/InterTight-ExtraLight.ttf +0 -0
  26. package/template/src/assets/fonts/InterTight-ExtraLightItalic.ttf +0 -0
  27. package/template/src/assets/fonts/InterTight-Italic.ttf +0 -0
  28. package/template/src/assets/fonts/InterTight-Light.ttf +0 -0
  29. package/template/src/assets/fonts/InterTight-LightItalic.ttf +0 -0
  30. package/template/src/assets/fonts/InterTight-Medium.ttf +0 -0
  31. package/template/src/assets/fonts/InterTight-MediumItalic.ttf +0 -0
  32. package/template/src/assets/fonts/InterTight-Regular.ttf +0 -0
  33. package/template/src/assets/fonts/InterTight-SemiBold.ttf +0 -0
  34. package/template/src/assets/fonts/InterTight-SemiBoldItalic.ttf +0 -0
  35. package/template/src/assets/fonts/InterTight-Thin.ttf +0 -0
  36. package/template/src/assets/fonts/InterTight-ThinItalic.ttf +0 -0
  37. package/template/src/assets/icons/back.svg +3 -0
  38. package/template/src/assets/icons/calendar.svg +3 -0
  39. package/template/src/assets/icons/claim_upload.svg +3 -0
  40. package/template/src/assets/icons/clock.svg +1 -0
  41. package/template/src/assets/icons/downArrow.svg +3 -0
  42. package/template/src/assets/icons/edit.svg +3 -0
  43. package/template/src/assets/icons/eye.svg +4 -0
  44. package/template/src/assets/icons/eyeClose.svg +7 -0
  45. package/template/src/assets/icons/folder.svg +5 -0
  46. package/template/src/assets/icons/home.svg +4 -0
  47. package/template/src/assets/icons/index.ts +35 -0
  48. package/template/src/assets/icons/log_out.svg +4 -0
  49. package/template/src/assets/icons/setting.svg +4 -0
  50. package/template/src/assets/icons/tabs/home/filled_dark.svg +3 -0
  51. package/template/src/assets/icons/tabs/home/filled_light.svg +3 -0
  52. package/template/src/assets/icons/tabs/home/outline.svg +4 -0
  53. package/template/src/assets/icons/tabs/index.ts +31 -0
  54. package/template/src/assets/icons/tabs/profile/filled_dark.svg +6 -0
  55. package/template/src/assets/icons/tabs/profile/filled_light.svg +6 -0
  56. package/template/src/assets/icons/tabs/profile/outline.svg +3 -0
  57. package/template/src/assets/icons/tooltip_dark.svg +1 -0
  58. package/template/src/assets/icons/tooltip_light.svg +1 -0
  59. package/template/src/assets/icons/upArrow.svg +3 -0
  60. package/template/src/assets/images/back.png +0 -0
  61. package/template/src/assets/images/index.ts +7 -0
  62. package/template/src/assets/images/placeholder/profile.png +0 -0
  63. package/template/src/components/shared/AppImage.tsx +190 -0
  64. package/template/src/components/shared/AvatarPicker.tsx +175 -0
  65. package/template/src/components/shared/CustomButton.tsx +273 -0
  66. package/template/src/components/shared/DocumentPicker.tsx +86 -0
  67. package/template/src/components/shared/GlobalLoader.tsx +47 -0
  68. package/template/src/components/shared/Icon.tsx +28 -0
  69. package/template/src/components/shared/PressableIcon.tsx +104 -0
  70. package/template/src/components/shared/bottom-sheet/BaseBottomSheet.tsx +30 -0
  71. package/template/src/components/shared/bottom-sheet/BaseBottomSheetModal.tsx +50 -0
  72. package/template/src/components/shared/bottom-sheet/sheets/ImagePickerSheet.tsx +310 -0
  73. package/template/src/components/shared/bottom-sheet/types.ts +4 -0
  74. package/template/src/components/shared/form-input/FormInput.tsx +140 -0
  75. package/template/src/components/shared/form-input/FormInputRenderer.tsx +82 -0
  76. package/template/src/components/shared/form-input/FullNameInput.tsx +243 -0
  77. package/template/src/components/shared/form-input/formFieldStyles.ts +43 -0
  78. package/template/src/components/shared/form-input/type.ts +188 -0
  79. package/template/src/components/shared/form-input/variants/CountryPhoneVariant.tsx +289 -0
  80. package/template/src/components/shared/form-input/variants/DateTimeVariant.tsx +280 -0
  81. package/template/src/components/shared/form-input/variants/DropdownVariant.tsx +221 -0
  82. package/template/src/components/shared/form-input/variants/TextInputVariant.tsx +300 -0
  83. package/template/src/components/shared/form-input/variants/ToggleVariant.tsx +194 -0
  84. package/template/src/components/shared/modal/BaseModal.tsx +83 -0
  85. package/template/src/components/shared/modal/common/AlertModal.tsx +173 -0
  86. package/template/src/components/shared/navigation/AnimatedTabIcon.tsx +37 -0
  87. package/template/src/components/shared/navigation/HeaderActionButton.tsx +70 -0
  88. package/template/src/components/shared/navigation/HeaderBackButton.tsx +38 -0
  89. package/template/src/components/shared/navigation/StackHeader.tsx +105 -0
  90. package/template/src/components/shared/navigation/tabIconRender.tsx +14 -0
  91. package/template/src/components/shared/offline/OfflineQueryBoundary.tsx +25 -0
  92. package/template/src/components/shared/offline/OfflineState.tsx +229 -0
  93. package/template/src/components/shared/offline/index.ts +6 -0
  94. package/template/src/components/shared/offline/types.ts +15 -0
  95. package/template/src/components/shared/offline/wifi-icon-animation/BrokenWifiAnimation.tsx +116 -0
  96. package/template/src/components/shared/offline/wifi-icon-animation/WifiPiece.tsx +80 -0
  97. package/template/src/components/shared/offline/wifi-icon-animation/geometry.ts +163 -0
  98. package/template/src/components/shared/offline/wifi-icon-animation/useWifiIconAnimationActive.ts +37 -0
  99. package/template/src/components/shared/skelton/BaseSkelton.tsx +71 -0
  100. package/template/src/components/shared/skelton/ShimmerHolder.ts +6 -0
  101. package/template/src/components/shared/skelton/holders/HomeShimmer.tsx +25 -0
  102. package/template/src/components/shared/skelton/holders/index.ts +1 -0
  103. package/template/src/components/shared/skelton/layouts/avatar.layout.ts +18 -0
  104. package/template/src/components/shared/skelton/layouts/home.layout.ts +16 -0
  105. package/template/src/components/shared/skelton/layouts/index.ts +3 -0
  106. package/template/src/components/shared/skelton/layouts/text.layout.ts +18 -0
  107. package/template/src/components/shared/text/CustomText.tsx +85 -0
  108. package/template/src/components/shared/text/ShimmerText.tsx +159 -0
  109. package/template/src/components/shared/text/types.ts +40 -0
  110. package/template/src/constants/device.ts +12 -0
  111. package/template/src/constants/endpoint.ts +11 -0
  112. package/template/src/constants/keyExtractor.ts +6 -0
  113. package/template/src/constants/limits.ts +9 -0
  114. package/template/src/constants/queryKey.ts +3 -0
  115. package/template/src/constants/regex.ts +7 -0
  116. package/template/src/context/NetworkContext.tsx +102 -0
  117. package/template/src/context/ThemeContext.tsx +56 -0
  118. package/template/src/hooks/app/index.ts +2 -0
  119. package/template/src/hooks/app/useGetProfile.ts +38 -0
  120. package/template/src/hooks/app/useUpdateProfile.ts +21 -0
  121. package/template/src/hooks/useAppDispatch.ts +6 -0
  122. package/template/src/hooks/useAppSelector.ts +4 -0
  123. package/template/src/hooks/useDebounce.ts +15 -0
  124. package/template/src/hooks/useDocumentPicker.ts +102 -0
  125. package/template/src/hooks/useImagePicker.ts +83 -0
  126. package/template/src/i18n/i18next.d.ts +9 -0
  127. package/template/src/i18n/index.ts +16 -0
  128. package/template/src/i18n/locales/en.json +274 -0
  129. package/template/src/i18n/locales/ru.json +165 -0
  130. package/template/src/i18n/resources.ts +11 -0
  131. package/template/src/redux/selectors/auth.selectors.ts +4 -0
  132. package/template/src/redux/slice/auth.slice.ts +23 -0
  133. package/template/src/redux/slice/loader.slice.ts +25 -0
  134. package/template/src/redux/slice/settings.slice.ts +26 -0
  135. package/template/src/redux/slice/user.slice.ts +25 -0
  136. package/template/src/screens/app/main-tab/index.tsx +73 -0
  137. package/template/src/screens/app/main-tab/style.ts +0 -0
  138. package/template/src/screens/app/profile-setup/index.tsx +162 -0
  139. package/template/src/screens/app/profile-setup/styles.ts +3 -0
  140. package/template/src/screens/auth/forgot-password/index.tsx +59 -0
  141. package/template/src/screens/auth/forgot-password/styles.ts +0 -0
  142. package/template/src/screens/auth/index.ts +4 -0
  143. package/template/src/screens/auth/login/index.tsx +138 -0
  144. package/template/src/screens/auth/login/styles.ts +3 -0
  145. package/template/src/screens/auth/signup/index.tsx +111 -0
  146. package/template/src/screens/auth/signup/styles.ts +3 -0
  147. package/template/src/screens/auth/verify-email/index.tsx +15 -0
  148. package/template/src/screens/auth/verify-email/styles.ts +3 -0
  149. package/template/src/screens/tab/home/index.tsx +49 -0
  150. package/template/src/screens/tab/home/styles.ts +3 -0
  151. package/template/src/screens/tab/index.ts +2 -0
  152. package/template/src/screens/tab/profile/index.tsx +50 -0
  153. package/template/src/screens/tab/profile/styles.ts +3 -0
  154. package/template/src/services/api/auth/auth.api.ts +22 -0
  155. package/template/src/services/api/auth/auth.endpoints.ts +7 -0
  156. package/template/src/services/api/auth/auth.types.ts +9 -0
  157. package/template/src/services/api/auth/index.ts +3 -0
  158. package/template/src/services/api/axios/axios.instance.ts +15 -0
  159. package/template/src/services/api/axios/axios.interceptors.ts +43 -0
  160. package/template/src/services/api/axios/index.ts +2 -0
  161. package/template/src/services/api/mock/mockAdapter.ts +97 -0
  162. package/template/src/services/api/user/index.ts +2 -0
  163. package/template/src/services/api/user/user.api.ts +67 -0
  164. package/template/src/services/api/user/user.endpoints.ts +0 -0
  165. package/template/src/services/api/user/user.types.ts +0 -0
  166. package/template/src/services/errors/backendErrorCodes.ts +7 -0
  167. package/template/src/services/errors/errorHandler.ts +94 -0
  168. package/template/src/services/errors/firebaseErrorMap.ts +61 -0
  169. package/template/src/services/errors/httpStatusMap.ts +47 -0
  170. package/template/src/services/errors/index.ts +4 -0
  171. package/template/src/services/network/index.ts +1 -0
  172. package/template/src/services/network/onlineManager.ts +22 -0
  173. package/template/src/services/query/index.ts +1 -0
  174. package/template/src/services/query/queryClient.ts +23 -0
  175. package/template/src/services/toast/ToastCard.tsx +137 -0
  176. package/template/src/services/toast/ToastConfig.tsx +32 -0
  177. package/template/src/services/toast/index.ts +3 -0
  178. package/template/src/services/toast/toast.ts +68 -0
  179. package/template/src/storage/mmkvAdapter.ts +3 -0
  180. package/template/src/storage/mmkvInstance.ts +16 -0
  181. package/template/src/store/index.ts +15 -0
  182. package/template/src/store/mmkv.ts +6 -0
  183. package/template/src/store/persist.ts +10 -0
  184. package/template/src/store/rootReducer.ts +26 -0
  185. package/template/src/theme/dark.ts +40 -0
  186. package/template/src/theme/fonts.ts +20 -0
  187. package/template/src/theme/index.ts +6 -0
  188. package/template/src/theme/layout.ts +23 -0
  189. package/template/src/theme/light.ts +41 -0
  190. package/template/src/theme/palette.ts +32 -0
  191. package/template/src/theme/spacing.ts +7 -0
  192. package/template/src/theme/typography.ts +80 -0
  193. package/template/src/types/api.types.ts +34 -0
  194. package/template/src/types/env.d.ts +6 -0
  195. package/template/src/types/index.ts +2 -0
  196. package/template/src/types/navigation.types.ts +94 -0
  197. package/template/src/utils/clearAppSession.ts +10 -0
  198. package/template/src/utils/date.ts +19 -0
  199. package/template/src/utils/documentPickerHandler.ts +96 -0
  200. package/template/src/utils/getFileNameFromUri.ts +18 -0
  201. package/template/src/utils/getInitials.ts +13 -0
  202. package/template/src/utils/hindiText.ts +33 -0
  203. package/template/src/utils/imageCompress.ts +97 -0
  204. package/template/src/utils/imagePickerHandler.ts +200 -0
  205. package/template/src/utils/maskPhone.ts +17 -0
  206. package/template/src/utils/normalize.ts +12 -0
  207. package/template/src/validation/messages.ts +11 -0
  208. package/template/src/validation/rules.ts +44 -0
  209. package/template/src/validation/schema/auth.schema.ts +53 -0
  210. package/template/src/validation/schema/user.schema.ts +46 -0
  211. package/template/src/validation/tValError.ts +13 -0
@@ -0,0 +1,83 @@
1
+ import React, { memo, ReactNode } from 'react';
2
+ import {
3
+ Modal,
4
+ ModalProps,
5
+ Pressable,
6
+ StyleSheet,
7
+ ViewProps,
8
+ } from 'react-native';
9
+ import { useAppTheme } from '@/context/ThemeContext';
10
+ import { palette } from '@/theme';
11
+
12
+ interface Props extends Partial<Omit<ModalProps, 'visible' | 'children'>> {
13
+ isOpen: boolean;
14
+ onClose?: () => void;
15
+ children: ReactNode;
16
+ overlayStyle?: ViewProps['style'];
17
+ contentStyle?: ViewProps['style'];
18
+ disableOverlayPress?: boolean;
19
+ }
20
+
21
+ const BaseModal = ({
22
+ isOpen,
23
+ onClose,
24
+ children,
25
+ overlayStyle,
26
+ contentStyle,
27
+ disableOverlayPress = false,
28
+ ...rest
29
+ }: Props) => {
30
+ const { color } = useAppTheme();
31
+
32
+ return (
33
+ <Modal
34
+ transparent
35
+ visible={isOpen}
36
+ animationType="fade"
37
+ presentationStyle="overFullScreen"
38
+ statusBarTranslucent
39
+ onRequestClose={onClose}
40
+ {...rest}
41
+ >
42
+ <Pressable
43
+ style={[styles.overlay, overlayStyle]}
44
+ disabled={disableOverlayPress}
45
+ onPress={onClose}
46
+ >
47
+ <Pressable
48
+ style={[
49
+ styles.content,
50
+ { backgroundColor: color.background_primary },
51
+ contentStyle,
52
+ ]}
53
+ >
54
+ {children}
55
+ </Pressable>
56
+ </Pressable>
57
+ </Modal>
58
+ );
59
+ };
60
+
61
+ export default memo(BaseModal);
62
+
63
+ const styles = StyleSheet.create({
64
+ overlay: {
65
+ flex: 1,
66
+ backgroundColor: 'rgba(0, 0, 0, 0.45)',
67
+ justifyContent: 'center',
68
+ alignItems: 'center',
69
+ paddingHorizontal: 28,
70
+ },
71
+ content: {
72
+ width: '100%',
73
+ borderRadius: 24,
74
+ paddingHorizontal: 24,
75
+ paddingTop: 28,
76
+ paddingBottom: 24,
77
+ shadowColor: palette.black[900],
78
+ shadowOffset: { width: 0, height: 8 },
79
+ shadowOpacity: 0.12,
80
+ shadowRadius: 24,
81
+ elevation: 10,
82
+ },
83
+ });
@@ -0,0 +1,173 @@
1
+ import React, { memo, useCallback, useMemo } from 'react';
2
+ import { StyleSheet, View, ViewStyle, StyleProp } from 'react-native';
3
+ import CustomText from '../../text/CustomText';
4
+ import CustomButton, { AppButtonProps } from '../../CustomButton';
5
+ import Icon from '../../Icon';
6
+ import BaseModal from '../BaseModal';
7
+ import { useAppTheme } from '@/context/ThemeContext';
8
+ import { IconName } from '@/assets/icons';
9
+ import { spacing } from '@/theme';
10
+
11
+ interface AlertModalProps {
12
+ isOpen: boolean;
13
+ title: string;
14
+ description?: string;
15
+ icon?: IconName;
16
+ iconSize?: number;
17
+ showPrimaryButton?: boolean;
18
+ showSecondaryButton?: boolean;
19
+ primaryButton?: Partial<Omit<AppButtonProps, 'onPress'>>;
20
+ secondaryButton?: Partial<Omit<AppButtonProps, 'onPress'>>;
21
+ onClose?: () => void;
22
+ closeOnOverlayPress?: boolean;
23
+ contentStyle?: StyleProp<ViewStyle>;
24
+ onPressPrimaryBtn?: () => void;
25
+ onPressSecondaryBtn?: () => void;
26
+ }
27
+
28
+ const AlertModal: React.FC<AlertModalProps> = ({
29
+ isOpen,
30
+ title,
31
+ description,
32
+ icon,
33
+ iconSize = 40,
34
+ showPrimaryButton = true,
35
+ showSecondaryButton = true,
36
+ primaryButton,
37
+ secondaryButton,
38
+ onClose,
39
+ closeOnOverlayPress = false,
40
+ contentStyle,
41
+ onPressPrimaryBtn,
42
+ onPressSecondaryBtn,
43
+ }) => {
44
+ const { color } = useAppTheme();
45
+
46
+ const resolvedPrimary = useMemo(
47
+ () => ({
48
+ title: 'Yes',
49
+ variant: 'danger' as const,
50
+ overrideVariantColor: color.danger_strong,
51
+ ...primaryButton,
52
+ }),
53
+ [color.danger_strong, primaryButton],
54
+ );
55
+
56
+ const resolvedSecondary = useMemo(
57
+ () => ({
58
+ title: 'Cancel',
59
+ variant: 'outline' as const,
60
+ overrideVariantColor: color.border,
61
+ overrideVariantTextColor: color.text_secondary,
62
+ ...secondaryButton,
63
+ }),
64
+ [color.border, color.text_secondary, secondaryButton],
65
+ );
66
+
67
+ const handlePrimaryPress = useCallback(() => {
68
+ onPressPrimaryBtn?.();
69
+ }, [onPressPrimaryBtn]);
70
+
71
+ const handleSecondaryPress = useCallback(() => {
72
+ onPressSecondaryBtn?.();
73
+ }, [onPressSecondaryBtn]);
74
+
75
+ return (
76
+ <BaseModal
77
+ isOpen={isOpen}
78
+ onClose={onClose ?? onPressSecondaryBtn}
79
+ disableOverlayPress={!closeOnOverlayPress}
80
+ contentStyle={[styles.content, contentStyle]}
81
+ >
82
+ {icon ? (
83
+ <View style={styles.iconWrap}>
84
+ <Icon
85
+ name={icon}
86
+ size={iconSize}
87
+ />
88
+ </View>
89
+ ) : null}
90
+
91
+ <CustomText
92
+ variant="titleSm"
93
+ weight="700"
94
+ textColor={color.text_heading}
95
+ textAlign="center"
96
+ style={styles.title}
97
+ >
98
+ {title}
99
+ </CustomText>
100
+
101
+ {description ? (
102
+ <CustomText
103
+ variant="label"
104
+ weight="400"
105
+ textColor={color.text_secondary}
106
+ textAlign="center"
107
+ style={styles.description}
108
+ >
109
+ {description}
110
+ </CustomText>
111
+ ) : null}
112
+
113
+ {(showPrimaryButton || showSecondaryButton) && (
114
+ <View style={styles.buttonContainer}>
115
+ {showSecondaryButton ? (
116
+ <CustomButton
117
+ {...resolvedSecondary}
118
+ onPress={handleSecondaryPress}
119
+ borderRadius={14}
120
+ textVariant="button"
121
+ textWeight="600"
122
+ containerStyle={[styles.button, resolvedSecondary.containerStyle]}
123
+ />
124
+ ) : null}
125
+
126
+ {showPrimaryButton ? (
127
+ <CustomButton
128
+ {...resolvedPrimary}
129
+ onPress={handlePrimaryPress}
130
+ borderRadius={14}
131
+ textVariant="button"
132
+ textWeight="600"
133
+ containerStyle={[styles.button, resolvedPrimary.containerStyle]}
134
+ />
135
+ ) : null}
136
+ </View>
137
+ )}
138
+ </BaseModal>
139
+ );
140
+ };
141
+
142
+ export default memo(AlertModal);
143
+
144
+ const styles = StyleSheet.create({
145
+ content: {
146
+ alignItems: 'center',
147
+ },
148
+ iconWrap: {
149
+ marginBottom: spacing.md,
150
+ alignItems: 'center',
151
+ justifyContent: 'center',
152
+ },
153
+ title: {
154
+ marginBottom: 8,
155
+ width: '100%',
156
+ },
157
+ description: {
158
+ marginBottom: 24,
159
+ width: '100%',
160
+ lineHeight: 20,
161
+ },
162
+ buttonContainer: {
163
+ flexDirection: 'row',
164
+ width: '100%',
165
+ gap: 12,
166
+ alignItems: 'stretch',
167
+ },
168
+ button: {
169
+ flex: 1,
170
+ minHeight: 48,
171
+ paddingVertical: 14,
172
+ },
173
+ });
@@ -0,0 +1,37 @@
1
+ import Animated, {
2
+ useAnimatedStyle,
3
+ withSpring,
4
+ } from 'react-native-reanimated';
5
+ import { TabIconName, TabIcons } from '@/assets/icons/tabs';
6
+ import { useAppTheme } from '@/context/ThemeContext';
7
+ import { useColorScheme } from 'react-native';
8
+
9
+ interface Props {
10
+ focused: boolean;
11
+ size?: number;
12
+ name: TabIconName;
13
+ }
14
+
15
+ const AnimatedTabIcon = ({ focused, name, size = 22 }: Props) => {
16
+ const { mode } = useAppTheme();
17
+ const systemScheme = useColorScheme();
18
+ const resolved: 'light' | 'dark' =
19
+ mode === 'system' ? (systemScheme === 'dark' ? 'dark' : 'light') : mode;
20
+ const Component = TabIcons[name][focused ? 'active' : 'inactive'][resolved];
21
+
22
+ const style = useAnimatedStyle(() => ({
23
+ transform: [
24
+ { scale: withSpring(focused ? 1.2 : 1) },
25
+ { translateY: withSpring(focused ? -2 : 0) },
26
+ ],
27
+ opacity: withSpring(focused ? 1 : 0.6),
28
+ }));
29
+
30
+ return (
31
+ <Animated.View style={style}>
32
+ <Component width={size} height={size} />
33
+ </Animated.View>
34
+ );
35
+ };
36
+
37
+ export default AnimatedTabIcon;
@@ -0,0 +1,70 @@
1
+ import { memo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import PressableIcon from '../PressableIcon';
4
+ import { IconName } from '@/assets/icons';
5
+ import { useAppTheme } from '@/context/ThemeContext';
6
+ import { normalize } from '@/utils/normalize';
7
+
8
+ type Props = {
9
+ icon: IconName;
10
+ onPress?: () => void;
11
+ /** Round elevated container (e.g. back). When false, icon only. */
12
+ isIconContainer?: boolean;
13
+ iconSize?: number;
14
+ accessibilityLabel?: string;
15
+ };
16
+
17
+ const HeaderActionButton = ({
18
+ icon,
19
+ onPress,
20
+ isIconContainer = false,
21
+ iconSize,
22
+ accessibilityLabel,
23
+ }: Props) => {
24
+ const { color } = useAppTheme();
25
+
26
+ if (!isIconContainer) {
27
+ return (
28
+ <PressableIcon
29
+ name={icon}
30
+ size={iconSize ?? 32}
31
+ onPress={onPress}
32
+ hitSlop={12}
33
+ containerStyle={styles.plain}
34
+ accessibilityLabel={accessibilityLabel}
35
+ />
36
+ );
37
+ }
38
+
39
+ return (
40
+ <PressableIcon
41
+ name={icon}
42
+ size={iconSize ?? 14}
43
+ onPress={onPress}
44
+ hitSlop={8}
45
+ backgroundColor={color.background_primary}
46
+ borderRadius={20}
47
+ containerStyle={[styles.container, { shadowColor: color.shadow_strong }]}
48
+ accessibilityLabel={accessibilityLabel}
49
+ />
50
+ );
51
+ };
52
+
53
+ export default memo(HeaderActionButton);
54
+
55
+ const styles = StyleSheet.create({
56
+ plain: {
57
+ width: normalize(32),
58
+ height: normalize(32),
59
+ backgroundColor: 'transparent',
60
+ },
61
+ container: {
62
+ width: 40,
63
+ height: 40,
64
+ overflow: 'visible',
65
+ shadowOffset: { width: 0, height: 7 },
66
+ shadowOpacity: 0.12,
67
+ shadowRadius: 18,
68
+ elevation: 8,
69
+ },
70
+ });
@@ -0,0 +1,38 @@
1
+ import { Pressable, StyleSheet } from 'react-native';
2
+ import { memo } from 'react';
3
+ import AppImage from '../AppImage';
4
+ import { GlobalImage } from '@/assets/images';
5
+ import { useAppTheme } from '@/context/ThemeContext';
6
+
7
+ const HeaderBackButton = ({ onPress }: { onPress: () => void }) => {
8
+ const { color } = useAppTheme();
9
+ return (
10
+ <Pressable
11
+ onPress={onPress}
12
+ hitSlop={20}
13
+ android_ripple={{ color: 'rgba(0,0,0,0.15)', borderless: true }}
14
+ style={({ pressed }) => [
15
+ {
16
+ opacity: pressed ? 0.6 : 1,
17
+ },
18
+ styles.iconCont,
19
+ ]}
20
+ >
21
+ <AppImage
22
+ source={GlobalImage.back}
23
+ style={styles.backIcon}
24
+ tintColor={color.text_primary}
25
+ />
26
+ </Pressable>
27
+ );
28
+ };
29
+
30
+ export default memo(HeaderBackButton);
31
+
32
+ const styles = StyleSheet.create({
33
+ iconCont: {
34
+ width: 22,
35
+ height: 22,
36
+ },
37
+ backIcon: { width: '100%', height: '100%' },
38
+ });
@@ -0,0 +1,105 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
+ import { useTranslation } from 'react-i18next';
5
+ import HeaderActionButton from './HeaderActionButton';
6
+ import CustomText from '../text/CustomText';
7
+ import { IconName } from '@/assets/icons';
8
+ import { useAppTheme } from '@/context/ThemeContext';
9
+ import { ColorType, spacing } from '@/theme';
10
+ import { normalize } from '@/utils/normalize';
11
+
12
+ type Props = {
13
+ title: string;
14
+ onBack?: () => void;
15
+ rightIcon?: IconName;
16
+ onRightPress?: () => void;
17
+ rightAccessibilityLabel?: string;
18
+ };
19
+
20
+ /** Full screen header — avoids iOS native bar-button glass wrapping. */
21
+ const StackHeader = ({
22
+ title,
23
+ onBack,
24
+ rightIcon,
25
+ onRightPress,
26
+ rightAccessibilityLabel,
27
+ }: Props) => {
28
+ const { t } = useTranslation();
29
+ const insets = useSafeAreaInsets();
30
+ const { color } = useAppTheme();
31
+ const styles = useMemo(() => makeStyles(color), [color]);
32
+
33
+ return (
34
+ <View style={[styles.wrap, { paddingTop: insets.top }]}>
35
+ <View style={styles.row}>
36
+ <View style={styles.side}>
37
+ {onBack ? (
38
+ <HeaderActionButton
39
+ icon="back"
40
+ isIconContainer
41
+ onPress={onBack}
42
+ accessibilityLabel={t('common.back')}
43
+ />
44
+ ) : null}
45
+ </View>
46
+
47
+ <View style={styles.titleWrap} pointerEvents="none">
48
+ <CustomText
49
+ variant="titleMd"
50
+ weight="600"
51
+ textColor={color.text_primary}
52
+ textAlign="center"
53
+ numberOfLines={1}
54
+ style={styles.title}
55
+ >
56
+ {title}
57
+ </CustomText>
58
+ </View>
59
+
60
+ <View style={[styles.side, styles.sideRight]}>
61
+ {rightIcon ? (
62
+ <HeaderActionButton
63
+ icon={rightIcon}
64
+ onPress={onRightPress}
65
+ accessibilityLabel={rightAccessibilityLabel}
66
+ />
67
+ ) : null}
68
+ </View>
69
+ </View>
70
+ </View>
71
+ );
72
+ };
73
+
74
+ export default memo(StackHeader);
75
+
76
+ const makeStyles = (color: ColorType) =>
77
+ StyleSheet.create({
78
+ wrap: {
79
+ backgroundColor: color.background_primary,
80
+ paddingHorizontal: spacing.md,
81
+ paddingBottom: spacing.sm,
82
+ },
83
+ row: {
84
+ flexDirection: 'row',
85
+ alignItems: 'center',
86
+ minHeight: normalize(44),
87
+ },
88
+ side: {
89
+ width: normalize(40),
90
+ alignItems: 'flex-start',
91
+ justifyContent: 'center',
92
+ },
93
+ sideRight: {
94
+ alignItems: 'flex-end',
95
+ },
96
+ titleWrap: {
97
+ flex: 1,
98
+ paddingHorizontal: spacing.sm,
99
+ },
100
+ title: {
101
+ marginBottom: 0,
102
+ lineHeight: normalize(22),
103
+ letterSpacing: -0.4,
104
+ },
105
+ });
@@ -0,0 +1,14 @@
1
+ import AnimatedTabIcon from './AnimatedTabIcon';
2
+
3
+ interface RenderTabIconProps {
4
+ focused: boolean;
5
+ size: number;
6
+ }
7
+
8
+ export const renderHomeIcon = (props: RenderTabIconProps) => (
9
+ <AnimatedTabIcon {...props} name="home" />
10
+ );
11
+
12
+ export const renderProfileIcon = (props: RenderTabIconProps) => (
13
+ <AnimatedTabIcon {...props} name="profile" />
14
+ );
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { useNetwork } from '@/context/NetworkContext';
3
+ import OfflineState from './OfflineState';
4
+ import type { OfflineQueryBoundaryProps } from './types';
5
+
6
+ /**
7
+ * - has data (online or offline) → children
8
+ * - no data + offline → offline UI
9
+ * - no data + online → loading
10
+ */
11
+ const OfflineQueryBoundary = ({
12
+ hasData,
13
+ loading = null,
14
+ children,
15
+ }: OfflineQueryBoundaryProps) => {
16
+ const { isOffline } = useNetwork();
17
+
18
+ if (hasData) {
19
+ return <>{children}</>;
20
+ }
21
+
22
+ return isOffline ? <OfflineState /> : <>{loading}</>;
23
+ };
24
+
25
+ export default OfflineQueryBoundary;