@croacroa/react-native-template 1.0.0 → 2.0.0

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 (69) hide show
  1. package/.github/workflows/ci.yml +187 -184
  2. package/.github/workflows/eas-build.yml +55 -55
  3. package/.github/workflows/eas-update.yml +50 -50
  4. package/CHANGELOG.md +106 -106
  5. package/CONTRIBUTING.md +377 -377
  6. package/README.md +399 -399
  7. package/__tests__/components/snapshots.test.tsx +131 -0
  8. package/__tests__/integration/auth-api.test.tsx +227 -0
  9. package/__tests__/performance/VirtualizedList.perf.test.tsx +362 -0
  10. package/app/(public)/onboarding.tsx +5 -5
  11. package/app.config.ts +45 -2
  12. package/assets/images/.gitkeep +7 -7
  13. package/components/onboarding/OnboardingScreen.tsx +370 -370
  14. package/components/onboarding/index.ts +2 -2
  15. package/components/providers/SuspenseBoundary.tsx +357 -0
  16. package/components/providers/index.ts +13 -0
  17. package/components/ui/Avatar.tsx +316 -316
  18. package/components/ui/Badge.tsx +416 -416
  19. package/components/ui/BottomSheet.tsx +307 -307
  20. package/components/ui/Checkbox.tsx +261 -261
  21. package/components/ui/OptimizedImage.tsx +369 -369
  22. package/components/ui/Select.tsx +240 -240
  23. package/components/ui/VirtualizedList.tsx +285 -0
  24. package/components/ui/index.ts +23 -18
  25. package/constants/config.ts +97 -54
  26. package/docs/adr/001-state-management.md +79 -79
  27. package/docs/adr/002-styling-approach.md +130 -130
  28. package/docs/adr/003-data-fetching.md +155 -155
  29. package/docs/adr/004-auth-adapter-pattern.md +144 -144
  30. package/docs/adr/README.md +78 -78
  31. package/hooks/index.ts +27 -25
  32. package/hooks/useApi.ts +102 -5
  33. package/hooks/useAuth.tsx +82 -0
  34. package/hooks/useBiometrics.ts +295 -295
  35. package/hooks/useDeepLinking.ts +256 -256
  36. package/hooks/useMFA.ts +499 -0
  37. package/hooks/useNotifications.ts +39 -0
  38. package/hooks/useOffline.ts +32 -2
  39. package/hooks/usePerformance.ts +434 -434
  40. package/hooks/useTheme.tsx +76 -0
  41. package/hooks/useUpdates.ts +358 -358
  42. package/i18n/index.ts +194 -77
  43. package/i18n/locales/ar.json +101 -0
  44. package/i18n/locales/de.json +101 -0
  45. package/i18n/locales/en.json +101 -101
  46. package/i18n/locales/es.json +101 -0
  47. package/i18n/locales/fr.json +101 -101
  48. package/jest.config.js +4 -4
  49. package/maestro/README.md +113 -113
  50. package/maestro/config.yaml +35 -35
  51. package/maestro/flows/login.yaml +62 -62
  52. package/maestro/flows/mfa-login.yaml +92 -0
  53. package/maestro/flows/mfa-setup.yaml +86 -0
  54. package/maestro/flows/navigation.yaml +68 -68
  55. package/maestro/flows/offline-conflict.yaml +101 -0
  56. package/maestro/flows/offline-sync.yaml +128 -0
  57. package/maestro/flows/offline.yaml +60 -60
  58. package/maestro/flows/register.yaml +94 -94
  59. package/package.json +175 -170
  60. package/services/analytics.ts +428 -428
  61. package/services/api.ts +340 -340
  62. package/services/authAdapter.ts +333 -333
  63. package/services/backgroundSync.ts +626 -0
  64. package/services/index.ts +54 -22
  65. package/services/security.ts +229 -0
  66. package/tailwind.config.js +47 -47
  67. package/utils/accessibility.ts +446 -446
  68. package/utils/index.ts +52 -43
  69. package/utils/withAccessibility.tsx +272 -0
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @fileoverview Theme management with light/dark mode support
3
+ * Provides context and hooks for managing app theme with system preference detection.
4
+ * @module hooks/useTheme
5
+ */
6
+
1
7
  import {
2
8
  createContext,
3
9
  useContext,
@@ -8,13 +14,27 @@ import {
8
14
  import { useColorScheme } from "react-native";
9
15
  import AsyncStorage from "@react-native-async-storage/async-storage";
10
16
 
17
+ /**
18
+ * Theme mode options
19
+ * - 'light': Force light theme
20
+ * - 'dark': Force dark theme
21
+ * - 'system': Follow device system preference
22
+ */
11
23
  type ThemeMode = "light" | "dark" | "system";
12
24
 
25
+ /**
26
+ * Theme context type definition
27
+ */
13
28
  interface ThemeContextType {
29
+ /** Current theme mode setting ('light', 'dark', or 'system') */
14
30
  mode: ThemeMode;
31
+ /** Whether the current effective theme is dark */
15
32
  isDark: boolean;
33
+ /** Whether the theme has been loaded from storage */
16
34
  isLoaded: boolean;
35
+ /** Set the theme mode and persist to storage */
17
36
  setMode: (mode: ThemeMode) => void;
37
+ /** Toggle between light and dark mode */
18
38
  toggleTheme: () => void;
19
39
  }
20
40
 
@@ -22,6 +42,29 @@ const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
22
42
 
23
43
  const THEME_KEY = "theme_mode";
24
44
 
45
+ /**
46
+ * Theme Provider component.
47
+ * Wraps your app to provide theme context with persistent preferences.
48
+ *
49
+ * Features:
50
+ * - System theme detection
51
+ * - Persistent theme preference
52
+ * - Real-time system theme updates
53
+ *
54
+ * @param children - Child components to wrap
55
+ *
56
+ * @example
57
+ * ```tsx
58
+ * // In your app root
59
+ * export default function RootLayout() {
60
+ * return (
61
+ * <ThemeProvider>
62
+ * <App />
63
+ * </ThemeProvider>
64
+ * );
65
+ * }
66
+ * ```
67
+ */
25
68
  export function ThemeProvider({ children }: { children: ReactNode }) {
26
69
  const systemColorScheme = useColorScheme();
27
70
  const [mode, setModeState] = useState<ThemeMode>("system");
@@ -76,6 +119,39 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
76
119
  );
77
120
  }
78
121
 
122
+ /**
123
+ * Hook to access theme state and controls.
124
+ * Must be used within a ThemeProvider.
125
+ *
126
+ * @returns Theme context with mode, isDark flag, and control functions
127
+ * @throws Error if used outside of ThemeProvider
128
+ *
129
+ * @example
130
+ * ```tsx
131
+ * function SettingsScreen() {
132
+ * const { mode, isDark, setMode, toggleTheme } = useTheme();
133
+ *
134
+ * return (
135
+ * <View>
136
+ * <Text>Current mode: {mode}</Text>
137
+ * <Text>Is dark: {isDark ? 'Yes' : 'No'}</Text>
138
+ *
139
+ * <Button onPress={toggleTheme}>Toggle Theme</Button>
140
+ *
141
+ * <Select
142
+ * value={mode}
143
+ * onValueChange={setMode}
144
+ * options={[
145
+ * { label: 'Light', value: 'light' },
146
+ * { label: 'Dark', value: 'dark' },
147
+ * { label: 'System', value: 'system' },
148
+ * ]}
149
+ * />
150
+ * </View>
151
+ * );
152
+ * }
153
+ * ```
154
+ */
79
155
  export function useTheme() {
80
156
  const context = useContext(ThemeContext);
81
157
  if (context === undefined) {