@umituz/react-native-auth 1.5.1 → 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/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);
|
|
@@ -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,
|