@umituz/react-native-auth 1.5.0 → 1.5.2
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/package.json +1 -1
- package/src/infrastructure/services/AuthService.ts +6 -0
- package/src/presentation/components/AuthContainer.tsx +5 -0
- package/src/presentation/components/AuthDivider.tsx +5 -0
- package/src/presentation/components/AuthErrorDisplay.tsx +5 -0
- package/src/presentation/components/AuthFormCard.tsx +5 -0
- package/src/presentation/components/AuthGradientBackground.tsx +5 -0
- package/src/presentation/components/AuthHeader.tsx +5 -0
- package/src/presentation/components/AuthLegalLinks.tsx +5 -0
- package/src/presentation/components/AuthLink.tsx +5 -0
- package/src/presentation/components/RegisterForm.tsx +4 -4
- package/src/presentation/hooks/useAuth.ts +14 -0
- package/src/presentation/utils/getAuthErrorMessage.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-auth",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design supports Firebase Auth and can be adapted for Supabase or other providers.",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -213,6 +213,9 @@ export class AuthService implements IAuthService {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
// Emit event for AppNavigator to handle navigation
|
|
217
|
+
// DeviceEventEmitter.emit("user-authenticated", { userId: userCredential.user.uid });
|
|
218
|
+
|
|
216
219
|
return userCredential.user;
|
|
217
220
|
} catch (error: any) {
|
|
218
221
|
throw mapFirebaseAuthError(error);
|
|
@@ -257,6 +260,9 @@ export class AuthService implements IAuthService {
|
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
|
|
263
|
+
// Emit event for AppNavigator to handle navigation
|
|
264
|
+
// DeviceEventEmitter.emit("user-authenticated", { userId: userCredential.user.uid });
|
|
265
|
+
|
|
260
266
|
return userCredential.user;
|
|
261
267
|
} catch (error: any) {
|
|
262
268
|
throw mapFirebaseAuthError(error);
|
|
@@ -141,7 +141,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
|
|
|
141
141
|
t("auth.displayNamePlaceholder") || "Enter your full name"
|
|
142
142
|
}
|
|
143
143
|
autoCapitalize="words"
|
|
144
|
-
|
|
144
|
+
disabled={loading}
|
|
145
145
|
state={fieldErrors.displayName ? "error" : "default"}
|
|
146
146
|
helperText={fieldErrors.displayName || undefined}
|
|
147
147
|
/>
|
|
@@ -155,7 +155,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
|
|
|
155
155
|
placeholder={t("auth.emailPlaceholder")}
|
|
156
156
|
keyboardType="email-address"
|
|
157
157
|
autoCapitalize="none"
|
|
158
|
-
|
|
158
|
+
disabled={loading}
|
|
159
159
|
state={fieldErrors.email ? "error" : "default"}
|
|
160
160
|
helperText={fieldErrors.email || undefined}
|
|
161
161
|
/>
|
|
@@ -169,7 +169,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
|
|
|
169
169
|
placeholder={t("auth.passwordPlaceholder")}
|
|
170
170
|
secureTextEntry
|
|
171
171
|
autoCapitalize="none"
|
|
172
|
-
|
|
172
|
+
disabled={loading}
|
|
173
173
|
state={fieldErrors.password ? "error" : "default"}
|
|
174
174
|
helperText={fieldErrors.password || undefined}
|
|
175
175
|
/>
|
|
@@ -185,7 +185,7 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({
|
|
|
185
185
|
}
|
|
186
186
|
secureTextEntry
|
|
187
187
|
autoCapitalize="none"
|
|
188
|
-
|
|
188
|
+
disabled={loading}
|
|
189
189
|
state={fieldErrors.confirmPassword ? "error" : "default"}
|
|
190
190
|
helperText={fieldErrors.confirmPassword || undefined}
|
|
191
191
|
/>
|
|
@@ -61,6 +61,19 @@ export function useAuth(): UseAuthResult {
|
|
|
61
61
|
const user = isGuest ? null : firebaseUser;
|
|
62
62
|
const isAuthenticated = !!user && !isGuest;
|
|
63
63
|
|
|
64
|
+
// Update authStatus whenever authentication state changes
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (firebaseLoading || loading) {
|
|
67
|
+
// setAuthStatus('loading'); // This line is removed
|
|
68
|
+
} else if (isAuthenticated) {
|
|
69
|
+
// setAuthStatus('authenticated'); // This line is removed
|
|
70
|
+
} else if (isGuest) {
|
|
71
|
+
// setAuthStatus('guest'); // This line is removed
|
|
72
|
+
} else {
|
|
73
|
+
// setAuthStatus('unauthenticated'); // This line is removed
|
|
74
|
+
}
|
|
75
|
+
}, [isAuthenticated, isGuest, firebaseLoading, loading]);
|
|
76
|
+
|
|
64
77
|
// Handle analytics initialization (if callbacks are provided in config)
|
|
65
78
|
useEffect(() => {
|
|
66
79
|
const authChanged =
|
|
@@ -161,6 +174,7 @@ export function useAuth(): UseAuthResult {
|
|
|
161
174
|
loading: loading || firebaseLoading,
|
|
162
175
|
isGuest,
|
|
163
176
|
isAuthenticated,
|
|
177
|
+
// authStatus, // This line is removed
|
|
164
178
|
error,
|
|
165
179
|
signUp,
|
|
166
180
|
signIn,
|