@umituz/react-native-auth 3.6.28 → 3.6.30
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.30",
|
|
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",
|
|
@@ -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,17 +112,24 @@ export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
|
|
|
110
112
|
justConvertedFromAnonymous,
|
|
111
113
|
});
|
|
112
114
|
}
|
|
113
|
-
//
|
|
114
|
-
executePendingCallback();
|
|
115
|
-
// Close modal and hide (without clearing callback again)
|
|
115
|
+
// Close modal and hide first
|
|
116
116
|
modalRef.current?.dismiss();
|
|
117
117
|
hideAuthModal();
|
|
118
|
+
// Notify auth success
|
|
119
|
+
onAuthSuccess?.();
|
|
120
|
+
// Execute callback with delay to ensure auth state has propagated
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
123
|
+
console.log("[useAuthBottomSheet] Executing pending callback after auth");
|
|
124
|
+
}
|
|
125
|
+
executePendingCallback();
|
|
126
|
+
}, 100);
|
|
118
127
|
}
|
|
119
128
|
|
|
120
129
|
prevIsAuthenticatedRef.current = isAuthenticated;
|
|
121
130
|
prevIsVisibleRef.current = isVisible;
|
|
122
131
|
prevIsAnonymousRef.current = isAnonymous;
|
|
123
|
-
}, [isAuthenticated, isVisible, isAnonymous, executePendingCallback, hideAuthModal]);
|
|
132
|
+
}, [isAuthenticated, isVisible, isAnonymous, executePendingCallback, hideAuthModal, onAuthSuccess]);
|
|
124
133
|
|
|
125
134
|
const handleNavigateToRegister = useCallback(() => {
|
|
126
135
|
setMode("register");
|