@umituz/react-native-firebase 2.4.57 → 2.4.59
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-firebase",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.59",
|
|
4
4
|
"description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This hook is optional and requires expo-auth-session to be installed
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { useState, useCallback, useEffect } from "react";
|
|
7
|
+
import { useState, useCallback, useEffect, useRef } from "react";
|
|
8
8
|
import { googleOAuthService } from "../../infrastructure/services/google-oauth.service";
|
|
9
9
|
import { getFirebaseAuth } from "../../infrastructure/config/FirebaseAuthClient";
|
|
10
10
|
import type { GoogleOAuthConfig } from "../../infrastructure/services/google-oauth.service";
|
|
@@ -61,6 +61,10 @@ export function useGoogleOAuth(config?: GoogleOAuthConfig): UseGoogleOAuthResult
|
|
|
61
61
|
const googleAvailable = googleOAuthService.isAvailable();
|
|
62
62
|
const googleConfigured = googleOAuthService.isConfigured(config);
|
|
63
63
|
|
|
64
|
+
// Keep config in a ref so the response useEffect doesn't re-run when config object reference changes
|
|
65
|
+
const configRef = useRef(config);
|
|
66
|
+
configRef.current = config;
|
|
67
|
+
|
|
64
68
|
// Call the Hook directly (only valid in React component)
|
|
65
69
|
// If expo-auth-session is not available, these will be null
|
|
66
70
|
const [request, response, promptAsync] = isExpoAuthAvailable && ExpoAuthSession
|
|
@@ -90,7 +94,7 @@ export function useGoogleOAuth(config?: GoogleOAuthConfig): UseGoogleOAuthResult
|
|
|
90
94
|
|
|
91
95
|
await googleOAuthService.signInWithOAuth(
|
|
92
96
|
auth,
|
|
93
|
-
|
|
97
|
+
configRef.current,
|
|
94
98
|
async () => response
|
|
95
99
|
);
|
|
96
100
|
} catch (error) {
|
|
@@ -107,7 +111,7 @@ export function useGoogleOAuth(config?: GoogleOAuthConfig): UseGoogleOAuthResult
|
|
|
107
111
|
};
|
|
108
112
|
|
|
109
113
|
handleResponse();
|
|
110
|
-
}, [response, googleAvailable
|
|
114
|
+
}, [response, googleAvailable]); // config read via ref to prevent re-running on reference changes
|
|
111
115
|
|
|
112
116
|
const signInWithGoogle = useCallback(async (): Promise<SocialAuthResult> => {
|
|
113
117
|
if (!googleAvailable) {
|