@umituz/react-native-auth 3.6.27 → 3.6.29
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-auth",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.29",
|
|
4
4
|
"description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design with dependency injection, configurable validation, and comprehensive error handling.",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -89,6 +89,18 @@ export class FirebaseAuthProvider implements IAuthProvider {
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
// Reload user to refresh token before linking (prevents token-expired errors)
|
|
93
|
+
try {
|
|
94
|
+
await currentUser.reload();
|
|
95
|
+
if (__DEV__) {
|
|
96
|
+
console.log("[FirebaseAuthProvider] User reloaded successfully");
|
|
97
|
+
}
|
|
98
|
+
} catch (reloadError) {
|
|
99
|
+
if (__DEV__) {
|
|
100
|
+
console.log("[FirebaseAuthProvider] Reload failed, proceeding with link:", reloadError);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
92
104
|
const credential = EmailAuthProvider.credential(
|
|
93
105
|
credentials.email.trim(),
|
|
94
106
|
credentials.password
|
|
@@ -32,6 +32,8 @@ export interface AuthBottomSheetProps {
|
|
|
32
32
|
onGoogleSignIn?: () => Promise<void>;
|
|
33
33
|
/** Called when Apple sign-in is requested (overrides internal behavior) */
|
|
34
34
|
onAppleSignIn?: () => Promise<void>;
|
|
35
|
+
/** Called when auth completes successfully (login or register) */
|
|
36
|
+
onAuthSuccess?: () => void;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export const AuthBottomSheet: React.FC<AuthBottomSheetProps> = ({
|
|
@@ -42,6 +44,7 @@ export const AuthBottomSheet: React.FC<AuthBottomSheetProps> = ({
|
|
|
42
44
|
socialConfig,
|
|
43
45
|
onGoogleSignIn,
|
|
44
46
|
onAppleSignIn,
|
|
47
|
+
onAuthSuccess,
|
|
45
48
|
}) => {
|
|
46
49
|
const tokens = useAppDesignTokens();
|
|
47
50
|
const { t } = useLocalization();
|
|
@@ -58,7 +61,7 @@ export const AuthBottomSheet: React.FC<AuthBottomSheetProps> = ({
|
|
|
58
61
|
handleNavigateToLogin,
|
|
59
62
|
handleGoogleSignIn,
|
|
60
63
|
handleAppleSignIn,
|
|
61
|
-
} = useAuthBottomSheet({ socialConfig, onGoogleSignIn, onAppleSignIn });
|
|
64
|
+
} = useAuthBottomSheet({ socialConfig, onGoogleSignIn, onAppleSignIn, onAuthSuccess });
|
|
62
65
|
|
|
63
66
|
useEffect(() => {
|
|
64
67
|
if (__DEV__) {
|
|
@@ -18,10 +18,12 @@ interface UseAuthBottomSheetParams {
|
|
|
18
18
|
socialConfig?: SocialAuthConfiguration;
|
|
19
19
|
onGoogleSignIn?: () => Promise<void>;
|
|
20
20
|
onAppleSignIn?: () => Promise<void>;
|
|
21
|
+
/** Called when auth completes successfully (login or register) */
|
|
22
|
+
onAuthSuccess?: () => void;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
|
|
24
|
-
const { socialConfig, onGoogleSignIn, onAppleSignIn } = params;
|
|
26
|
+
const { socialConfig, onGoogleSignIn, onAppleSignIn, onAuthSuccess } = params;
|
|
25
27
|
|
|
26
28
|
const modalRef = useRef<BottomSheetModalRef>(null);
|
|
27
29
|
const [googleLoading, setGoogleLoading] = useState(false);
|
|
@@ -110,6 +112,8 @@ export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
|
|
|
110
112
|
justConvertedFromAnonymous,
|
|
111
113
|
});
|
|
112
114
|
}
|
|
115
|
+
// Notify auth success BEFORE executing pending callback
|
|
116
|
+
onAuthSuccess?.();
|
|
113
117
|
// Execute callback BEFORE closing to prevent clearPendingCallback from clearing it
|
|
114
118
|
executePendingCallback();
|
|
115
119
|
// Close modal and hide (without clearing callback again)
|
|
@@ -120,7 +124,7 @@ export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
|
|
|
120
124
|
prevIsAuthenticatedRef.current = isAuthenticated;
|
|
121
125
|
prevIsVisibleRef.current = isVisible;
|
|
122
126
|
prevIsAnonymousRef.current = isAnonymous;
|
|
123
|
-
}, [isAuthenticated, isVisible, isAnonymous, executePendingCallback, hideAuthModal]);
|
|
127
|
+
}, [isAuthenticated, isVisible, isAnonymous, executePendingCallback, hideAuthModal, onAuthSuccess]);
|
|
124
128
|
|
|
125
129
|
const handleNavigateToRegister = useCallback(() => {
|
|
126
130
|
setMode("register");
|