@umituz/react-native-firebase 1.13.11 → 1.13.12

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": "1.13.11",
3
+ "version": "1.13.12",
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",
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { useEffect, useState, useRef, useCallback } from "react";
10
10
  import { onAuthStateChanged, type User } from "firebase/auth";
11
- import { getFirebaseAuth, isFirebaseAuthInitialized } from "../../infrastructure/config/FirebaseAuthClient";
11
+ import { getFirebaseAuth } from "../../infrastructure/config/FirebaseAuthClient";
12
12
 
13
13
  declare const __DEV__: boolean;
14
14
 
@@ -71,10 +71,11 @@ export function useFirebaseAuth(): UseFirebaseAuthResult {
71
71
  }, []);
72
72
 
73
73
  useEffect(() => {
74
- // Try to subscribe immediately if Firebase is ready
75
- if (isFirebaseAuthInitialized()) {
74
+ // Try to subscribe immediately - getFirebaseAuth() will auto-initialize
75
+ const auth = getFirebaseAuth();
76
+ if (auth) {
76
77
  if (__DEV__) {
77
- console.log('[useFirebaseAuth] Firebase already initialized, subscribing...');
78
+ console.log('[useFirebaseAuth] Firebase Auth available, subscribing...');
78
79
  }
79
80
  setInitialized(true);
80
81
  subscribeToAuth();
@@ -85,18 +86,20 @@ export function useFirebaseAuth(): UseFirebaseAuthResult {
85
86
  };
86
87
  }
87
88
 
88
- // Firebase not ready, start polling
89
+ // Firebase not ready, start polling with getFirebaseAuth() which auto-initializes
89
90
  if (__DEV__) {
90
- console.log('[useFirebaseAuth] Firebase not initialized, starting retry...');
91
+ console.log('[useFirebaseAuth] Firebase Auth not available, starting retry...');
91
92
  }
92
93
 
93
94
  retryIntervalRef.current = setInterval(() => {
94
95
  retryCountRef.current += 1;
95
96
 
96
- if (isFirebaseAuthInitialized()) {
97
- // Firebase is now initialized, subscribe and stop polling
97
+ // getFirebaseAuth() will auto-initialize if Firebase App is available
98
+ const authInstance = getFirebaseAuth();
99
+ if (authInstance) {
100
+ // Firebase Auth is now available, subscribe and stop polling
98
101
  if (__DEV__) {
99
- console.log('[useFirebaseAuth] Firebase initialized after', retryCountRef.current, 'retries');
102
+ console.log('[useFirebaseAuth] Firebase Auth available after', retryCountRef.current, 'retries');
100
103
  }
101
104
 
102
105
  if (retryIntervalRef.current) {
@@ -112,7 +115,7 @@ export function useFirebaseAuth(): UseFirebaseAuthResult {
112
115
  if (retryCountRef.current >= MAX_RETRY_ATTEMPTS) {
113
116
  // Max retries reached, stop polling
114
117
  if (__DEV__) {
115
- console.log('[useFirebaseAuth] Max retries reached, Firebase not initialized');
118
+ console.log('[useFirebaseAuth] Max retries reached, Firebase Auth not available');
116
119
  }
117
120
 
118
121
  if (retryIntervalRef.current) {