@croacroa/react-native-template 1.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 (109) hide show
  1. package/.env.example +18 -0
  2. package/.eslintrc.js +55 -0
  3. package/.github/workflows/ci.yml +184 -0
  4. package/.github/workflows/eas-build.yml +55 -0
  5. package/.github/workflows/eas-update.yml +50 -0
  6. package/.gitignore +62 -0
  7. package/.prettierrc +11 -0
  8. package/.storybook/main.ts +28 -0
  9. package/.storybook/preview.tsx +30 -0
  10. package/CHANGELOG.md +106 -0
  11. package/CONTRIBUTING.md +377 -0
  12. package/README.md +399 -0
  13. package/__tests__/components/Button.test.tsx +74 -0
  14. package/__tests__/hooks/useAuth.test.tsx +499 -0
  15. package/__tests__/services/api.test.ts +535 -0
  16. package/__tests__/utils/cn.test.ts +39 -0
  17. package/app/(auth)/_layout.tsx +36 -0
  18. package/app/(auth)/home.tsx +117 -0
  19. package/app/(auth)/profile.tsx +152 -0
  20. package/app/(auth)/settings.tsx +147 -0
  21. package/app/(public)/_layout.tsx +21 -0
  22. package/app/(public)/forgot-password.tsx +127 -0
  23. package/app/(public)/login.tsx +120 -0
  24. package/app/(public)/onboarding.tsx +5 -0
  25. package/app/(public)/register.tsx +139 -0
  26. package/app/_layout.tsx +97 -0
  27. package/app/index.tsx +21 -0
  28. package/app.config.ts +72 -0
  29. package/assets/images/.gitkeep +7 -0
  30. package/assets/images/adaptive-icon.png +0 -0
  31. package/assets/images/favicon.png +0 -0
  32. package/assets/images/icon.png +0 -0
  33. package/assets/images/notification-icon.png +0 -0
  34. package/assets/images/splash.png +0 -0
  35. package/babel.config.js +10 -0
  36. package/components/ErrorBoundary.tsx +169 -0
  37. package/components/forms/FormInput.tsx +78 -0
  38. package/components/forms/index.ts +1 -0
  39. package/components/onboarding/OnboardingScreen.tsx +370 -0
  40. package/components/onboarding/index.ts +2 -0
  41. package/components/ui/AnimatedButton.tsx +156 -0
  42. package/components/ui/AnimatedCard.tsx +108 -0
  43. package/components/ui/Avatar.tsx +316 -0
  44. package/components/ui/Badge.tsx +416 -0
  45. package/components/ui/BottomSheet.tsx +307 -0
  46. package/components/ui/Button.stories.tsx +115 -0
  47. package/components/ui/Button.tsx +104 -0
  48. package/components/ui/Card.stories.tsx +84 -0
  49. package/components/ui/Card.tsx +32 -0
  50. package/components/ui/Checkbox.tsx +261 -0
  51. package/components/ui/Input.stories.tsx +106 -0
  52. package/components/ui/Input.tsx +117 -0
  53. package/components/ui/Modal.tsx +98 -0
  54. package/components/ui/OptimizedImage.tsx +369 -0
  55. package/components/ui/Select.tsx +240 -0
  56. package/components/ui/Skeleton.tsx +180 -0
  57. package/components/ui/index.ts +18 -0
  58. package/constants/config.ts +54 -0
  59. package/docs/adr/001-state-management.md +79 -0
  60. package/docs/adr/002-styling-approach.md +130 -0
  61. package/docs/adr/003-data-fetching.md +155 -0
  62. package/docs/adr/004-auth-adapter-pattern.md +144 -0
  63. package/docs/adr/README.md +78 -0
  64. package/eas.json +47 -0
  65. package/global.css +10 -0
  66. package/hooks/index.ts +25 -0
  67. package/hooks/useApi.ts +236 -0
  68. package/hooks/useAuth.tsx +290 -0
  69. package/hooks/useBiometrics.ts +295 -0
  70. package/hooks/useDeepLinking.ts +256 -0
  71. package/hooks/useNotifications.ts +138 -0
  72. package/hooks/useOffline.ts +69 -0
  73. package/hooks/usePerformance.ts +434 -0
  74. package/hooks/useTheme.tsx +85 -0
  75. package/hooks/useUpdates.ts +358 -0
  76. package/i18n/index.ts +77 -0
  77. package/i18n/locales/en.json +101 -0
  78. package/i18n/locales/fr.json +101 -0
  79. package/jest.config.js +32 -0
  80. package/maestro/README.md +113 -0
  81. package/maestro/config.yaml +35 -0
  82. package/maestro/flows/login.yaml +62 -0
  83. package/maestro/flows/navigation.yaml +68 -0
  84. package/maestro/flows/offline.yaml +60 -0
  85. package/maestro/flows/register.yaml +94 -0
  86. package/metro.config.js +6 -0
  87. package/nativewind-env.d.ts +1 -0
  88. package/package.json +170 -0
  89. package/scripts/init.ps1 +162 -0
  90. package/scripts/init.sh +174 -0
  91. package/services/analytics.ts +428 -0
  92. package/services/api.ts +340 -0
  93. package/services/authAdapter.ts +333 -0
  94. package/services/index.ts +22 -0
  95. package/services/queryClient.ts +97 -0
  96. package/services/sentry.ts +131 -0
  97. package/services/storage.ts +82 -0
  98. package/stores/appStore.ts +54 -0
  99. package/stores/index.ts +2 -0
  100. package/stores/notificationStore.ts +40 -0
  101. package/tailwind.config.js +47 -0
  102. package/tsconfig.json +26 -0
  103. package/types/index.ts +42 -0
  104. package/types/user.ts +63 -0
  105. package/utils/accessibility.ts +446 -0
  106. package/utils/cn.ts +14 -0
  107. package/utils/index.ts +43 -0
  108. package/utils/toast.ts +113 -0
  109. package/utils/validation.ts +67 -0
@@ -0,0 +1,162 @@
1
+ # =============================================================================
2
+ # Template Initialization Script (Windows PowerShell)
3
+ # =============================================================================
4
+ # This script customizes the template for a new project
5
+ #
6
+ # Usage: .\scripts\init.ps1
7
+ # =============================================================================
8
+
9
+ $ErrorActionPreference = "Stop"
10
+
11
+ function Write-Step {
12
+ param([string]$Message)
13
+ Write-Host "==> " -ForegroundColor Blue -NoNewline
14
+ Write-Host $Message
15
+ }
16
+
17
+ function Write-Success {
18
+ param([string]$Message)
19
+ Write-Host "✓ " -ForegroundColor Green -NoNewline
20
+ Write-Host $Message
21
+ }
22
+
23
+ function Write-Warning {
24
+ param([string]$Message)
25
+ Write-Host "⚠ " -ForegroundColor Yellow -NoNewline
26
+ Write-Host $Message
27
+ }
28
+
29
+ function Write-Error {
30
+ param([string]$Message)
31
+ Write-Host "✗ " -ForegroundColor Red -NoNewline
32
+ Write-Host $Message
33
+ }
34
+
35
+ # Header
36
+ Write-Host ""
37
+ Write-Host "╔════════════════════════════════════════════════════════════╗" -ForegroundColor Blue
38
+ Write-Host "║ React Native Template Initialization ║" -ForegroundColor Blue
39
+ Write-Host "╚════════════════════════════════════════════════════════════╝" -ForegroundColor Blue
40
+ Write-Host ""
41
+
42
+ # Get project info from user
43
+ $APP_NAME = Read-Host "Enter app name [e.g., MyAwesomeApp]"
44
+ if ([string]::IsNullOrEmpty($APP_NAME)) {
45
+ Write-Error "App name is required"
46
+ exit 1
47
+ }
48
+
49
+ $BUNDLE_ID = Read-Host "Enter bundle identifier [e.g., com.yourcompany.myapp]"
50
+ if ([string]::IsNullOrEmpty($BUNDLE_ID)) {
51
+ Write-Error "Bundle identifier is required"
52
+ exit 1
53
+ }
54
+
55
+ $APP_SCHEME = Read-Host "Enter app scheme [e.g., myapp] (leave empty for default)"
56
+ if ([string]::IsNullOrEmpty($APP_SCHEME)) {
57
+ $APP_SCHEME = $APP_NAME.ToLower() -replace '\s', ''
58
+ }
59
+
60
+ $COMPANY_NAME = Read-Host "Enter company/author name [e.g., Your Company]"
61
+ if ([string]::IsNullOrEmpty($COMPANY_NAME)) {
62
+ $COMPANY_NAME = "Your Company"
63
+ }
64
+
65
+ Write-Host ""
66
+ Write-Step "Configuring project with:"
67
+ Write-Host " App Name: $APP_NAME"
68
+ Write-Host " Bundle ID: $BUNDLE_ID"
69
+ Write-Host " Scheme: $APP_SCHEME"
70
+ Write-Host " Company: $COMPANY_NAME"
71
+ Write-Host ""
72
+
73
+ # Confirm
74
+ $CONFIRM = Read-Host "Proceed with these settings? [y/N]"
75
+ if ($CONFIRM -notmatch "^[Yy]$") {
76
+ Write-Warning "Cancelled"
77
+ exit 0
78
+ }
79
+
80
+ Write-Host ""
81
+ Write-Step "Updating configuration files..."
82
+
83
+ # Create slug from app name
84
+ $APP_SLUG = $APP_NAME.ToLower() -replace '\s', '-'
85
+
86
+ # Update package.json
87
+ if (Test-Path "package.json") {
88
+ $content = Get-Content "package.json" -Raw
89
+ $content = $content -replace '"name": "react-native-template"', "`"name`": `"$APP_SLUG`""
90
+ Set-Content "package.json" $content -NoNewline
91
+ Write-Success "Updated package.json"
92
+ }
93
+
94
+ # Update app.config.ts
95
+ if (Test-Path "app.config.ts") {
96
+ $content = Get-Content "app.config.ts" -Raw
97
+ $content = $content -replace 'YourApp', $APP_NAME
98
+ $content = $content -replace 'yourapp', $APP_SCHEME
99
+ $content = $content -replace 'com\.yourcompany\.yourapp', $BUNDLE_ID
100
+ Set-Content "app.config.ts" $content -NoNewline
101
+ Write-Success "Updated app.config.ts"
102
+ }
103
+
104
+ # Update constants/config.ts
105
+ if (Test-Path "constants/config.ts") {
106
+ $content = Get-Content "constants/config.ts" -Raw
107
+ $content = $content -replace 'YourApp', $APP_NAME
108
+ $content = $content -replace 'yourapp', $APP_SCHEME
109
+ Set-Content "constants/config.ts" $content -NoNewline
110
+ Write-Success "Updated constants/config.ts"
111
+ }
112
+
113
+ # Update eas.json
114
+ if (Test-Path "eas.json") {
115
+ $content = Get-Content "eas.json" -Raw
116
+ $content = $content -replace 'com\.yourcompany\.yourapp', $BUNDLE_ID
117
+ Set-Content "eas.json" $content -NoNewline
118
+ Write-Success "Updated eas.json"
119
+ }
120
+
121
+ # Create .env from .env.example
122
+ if ((Test-Path ".env.example") -and !(Test-Path ".env")) {
123
+ Copy-Item ".env.example" ".env"
124
+ Write-Success "Created .env from .env.example"
125
+ }
126
+
127
+ # Initialize git if not already
128
+ if (!(Test-Path ".git")) {
129
+ Write-Step "Initializing git repository..."
130
+ git init
131
+ Write-Success "Initialized git repository"
132
+ }
133
+
134
+ # Install dependencies
135
+ Write-Step "Installing dependencies..."
136
+ npm install --legacy-peer-deps
137
+ Write-Success "Dependencies installed"
138
+
139
+ # Run type check
140
+ Write-Step "Running type check..."
141
+ try {
142
+ npm run typecheck
143
+ Write-Success "Type check passed"
144
+ } catch {
145
+ Write-Warning "Type check had issues - you may need to fix some types"
146
+ }
147
+
148
+ # Summary
149
+ Write-Host ""
150
+ Write-Host "╔════════════════════════════════════════════════════════════╗" -ForegroundColor Green
151
+ Write-Host "║ Setup Complete! 🎉 ║" -ForegroundColor Green
152
+ Write-Host "╚════════════════════════════════════════════════════════════╝" -ForegroundColor Green
153
+ Write-Host ""
154
+ Write-Host "Next steps:"
155
+ Write-Host ""
156
+ Write-Host " 1. Review and update your .env file"
157
+ Write-Host " 2. Run 'npx expo start' to start development"
158
+ Write-Host " 3. Configure Sentry DSN in .env for crash reporting"
159
+ Write-Host " 4. Set up EAS Build: 'eas build:configure'"
160
+ Write-Host ""
161
+ Write-Host "Happy coding! 🚀"
162
+ Write-Host ""
@@ -0,0 +1,174 @@
1
+ #!/bin/bash
2
+
3
+ # =============================================================================
4
+ # Template Initialization Script
5
+ # =============================================================================
6
+ # This script customizes the template for a new project
7
+ #
8
+ # Usage: ./scripts/init.sh
9
+ # =============================================================================
10
+
11
+ set -e
12
+
13
+ # Colors for output
14
+ RED='\033[0;31m'
15
+ GREEN='\033[0;32m'
16
+ YELLOW='\033[1;33m'
17
+ BLUE='\033[0;34m'
18
+ NC='\033[0m' # No Color
19
+
20
+ # Print with color
21
+ print_step() {
22
+ echo -e "${BLUE}==>${NC} $1"
23
+ }
24
+
25
+ print_success() {
26
+ echo -e "${GREEN}✓${NC} $1"
27
+ }
28
+
29
+ print_warning() {
30
+ echo -e "${YELLOW}⚠${NC} $1"
31
+ }
32
+
33
+ print_error() {
34
+ echo -e "${RED}✗${NC} $1"
35
+ }
36
+
37
+ # Header
38
+ echo ""
39
+ echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
40
+ echo -e "${BLUE}║${NC} React Native Template Initialization ${BLUE}║${NC}"
41
+ echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
42
+ echo ""
43
+
44
+ # Get project info from user
45
+ read -p "$(echo -e ${BLUE}Enter app name ${NC}[e.g., MyAwesomeApp]: )" APP_NAME
46
+ if [ -z "$APP_NAME" ]; then
47
+ print_error "App name is required"
48
+ exit 1
49
+ fi
50
+
51
+ read -p "$(echo -e ${BLUE}Enter bundle identifier ${NC}[e.g., com.yourcompany.myapp]: )" BUNDLE_ID
52
+ if [ -z "$BUNDLE_ID" ]; then
53
+ print_error "Bundle identifier is required"
54
+ exit 1
55
+ fi
56
+
57
+ read -p "$(echo -e ${BLUE}Enter app scheme ${NC}[e.g., myapp]: )" APP_SCHEME
58
+ if [ -z "$APP_SCHEME" ]; then
59
+ # Default to lowercase app name
60
+ APP_SCHEME=$(echo "$APP_NAME" | tr '[:upper:]' '[:lower:]' | tr -d ' ')
61
+ fi
62
+
63
+ read -p "$(echo -e ${BLUE}Enter company/author name ${NC}[e.g., Your Company]: )" COMPANY_NAME
64
+ if [ -z "$COMPANY_NAME" ]; then
65
+ COMPANY_NAME="Your Company"
66
+ fi
67
+
68
+ echo ""
69
+ print_step "Configuring project with:"
70
+ echo " App Name: $APP_NAME"
71
+ echo " Bundle ID: $BUNDLE_ID"
72
+ echo " Scheme: $APP_SCHEME"
73
+ echo " Company: $COMPANY_NAME"
74
+ echo ""
75
+
76
+ # Confirm
77
+ read -p "$(echo -e ${YELLOW}Proceed with these settings? ${NC}[y/N]: )" CONFIRM
78
+ if [[ ! "$CONFIRM" =~ ^[Yy]$ ]]; then
79
+ print_warning "Cancelled"
80
+ exit 0
81
+ fi
82
+
83
+ echo ""
84
+ print_step "Updating configuration files..."
85
+
86
+ # Update package.json
87
+ if [ -f "package.json" ]; then
88
+ # Create lowercase slug from app name
89
+ APP_SLUG=$(echo "$APP_NAME" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
90
+
91
+ if command -v jq &> /dev/null; then
92
+ # Use jq if available
93
+ jq --arg name "$APP_SLUG" '.name = $name' package.json > tmp.json && mv tmp.json package.json
94
+ else
95
+ # Fallback to sed
96
+ sed -i.bak "s/\"name\": \"react-native-template\"/\"name\": \"$APP_SLUG\"/g" package.json
97
+ rm -f package.json.bak
98
+ fi
99
+ print_success "Updated package.json"
100
+ fi
101
+
102
+ # Update app.config.ts
103
+ if [ -f "app.config.ts" ]; then
104
+ sed -i.bak "s/YourApp/$APP_NAME/g" app.config.ts
105
+ sed -i.bak "s/yourapp/$APP_SCHEME/g" app.config.ts
106
+ sed -i.bak "s/com\.yourcompany\.yourapp/$BUNDLE_ID/g" app.config.ts
107
+ rm -f app.config.ts.bak
108
+ print_success "Updated app.config.ts"
109
+ fi
110
+
111
+ # Update constants/config.ts
112
+ if [ -f "constants/config.ts" ]; then
113
+ sed -i.bak "s/YourApp/$APP_NAME/g" constants/config.ts
114
+ sed -i.bak "s/yourapp/$APP_SCHEME/g" constants/config.ts
115
+ rm -f constants/config.ts.bak
116
+ print_success "Updated constants/config.ts"
117
+ fi
118
+
119
+ # Update eas.json
120
+ if [ -f "eas.json" ]; then
121
+ sed -i.bak "s/com\.yourcompany\.yourapp/$BUNDLE_ID/g" eas.json
122
+ rm -f eas.json.bak
123
+ print_success "Updated eas.json"
124
+ fi
125
+
126
+ # Create .env from .env.example
127
+ if [ -f ".env.example" ] && [ ! -f ".env" ]; then
128
+ cp .env.example .env
129
+ print_success "Created .env from .env.example"
130
+ fi
131
+
132
+ # Initialize git if not already
133
+ if [ ! -d ".git" ]; then
134
+ print_step "Initializing git repository..."
135
+ git init
136
+ print_success "Initialized git repository"
137
+ fi
138
+
139
+ # Install dependencies
140
+ print_step "Installing dependencies..."
141
+ if command -v bun &> /dev/null; then
142
+ bun install
143
+ elif command -v pnpm &> /dev/null; then
144
+ pnpm install
145
+ elif command -v yarn &> /dev/null; then
146
+ yarn install
147
+ else
148
+ npm install --legacy-peer-deps
149
+ fi
150
+ print_success "Dependencies installed"
151
+
152
+ # Run type check
153
+ print_step "Running type check..."
154
+ if npm run typecheck 2>/dev/null; then
155
+ print_success "Type check passed"
156
+ else
157
+ print_warning "Type check had issues - you may need to fix some types"
158
+ fi
159
+
160
+ # Summary
161
+ echo ""
162
+ echo -e "${GREEN}╔════════════════════════════════════════════════════════════╗${NC}"
163
+ echo -e "${GREEN}║${NC} Setup Complete! 🎉 ${GREEN}║${NC}"
164
+ echo -e "${GREEN}╚════════════════════════════════════════════════════════════╝${NC}"
165
+ echo ""
166
+ echo "Next steps:"
167
+ echo ""
168
+ echo " 1. Review and update your .env file"
169
+ echo " 2. Run 'npx expo start' to start development"
170
+ echo " 3. Configure Sentry DSN in .env for crash reporting"
171
+ echo " 4. Set up EAS Build: 'eas build:configure'"
172
+ echo ""
173
+ echo "Happy coding! 🚀"
174
+ echo ""