react-query-firebase 2.6.0 → 2.6.1

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
@@ -74,5 +74,5 @@
74
74
  "docs:build": "vitepress build docs",
75
75
  "docs:preview": "vitepress preview docs"
76
76
  },
77
- "version": "2.6.0"
77
+ "version": "2.6.1"
78
78
  }
@@ -1,10 +1,10 @@
1
1
  import React, { useEffect, useMemo } from "react";
2
2
  import { FirebaseContext } from "./FirebaseContext";
3
- import auth, { connectAuthEmulator } from "@react-native-firebase/auth";
4
- import analytics, { setAnalyticsCollectionEnabled, setConsent } from "@react-native-firebase/analytics";
5
- import remoteConfig from "@react-native-firebase/remote-config";
6
- import firestore, { connectFirestoreEmulator } from "@react-native-firebase/firestore";
7
- import firebase from "@react-native-firebase/app";
3
+ import { connectAuthEmulator, getAuth } from "@react-native-firebase/auth";
4
+ import { setAnalyticsCollectionEnabled, setConsent, getAnalytics } from "@react-native-firebase/analytics";
5
+ import { getRemoteConfig } from "@react-native-firebase/remote-config";
6
+ import { connectFirestoreEmulator, getFirestore } from "@react-native-firebase/firestore";
7
+ import { getApp } from "@react-native-firebase/app";
8
8
  /**
9
9
  * FirebaseContextProvider component configures and provides Firebase services to its children.
10
10
  * Initializes Firebase app and enables optional Firebase services such as Firestore, Auth, Analytics,
@@ -29,9 +29,9 @@ import firebase from "@react-native-firebase/app";
29
29
  * ```
30
30
  */
31
31
  export const FirebaseContextProvider = ({ emulators, children, authEnabled = true, firestoreEnabled = true, analyticsEnabled = true, consentSettings = {}, remoteConfigEnabled = true, remoteConfigSettings, remoteConfigDefaults = {}, firestoreSettings }) => {
32
- const internalFirebase = useMemo(() => firebase, []);
32
+ const internalFirebase = useMemo(() => getApp(), []);
33
33
  useEffect(() => {
34
- setConsent(analytics(), {
34
+ setConsent(getAnalytics(internalFirebase), {
35
35
  ad_personalization: false,
36
36
  ad_storage: false,
37
37
  ad_user_data: false,
@@ -41,23 +41,23 @@ export const FirebaseContextProvider = ({ emulators, children, authEnabled = tru
41
41
  security_storage: false,
42
42
  ...consentSettings
43
43
  });
44
- }, [consentSettings]);
44
+ }, [consentSettings, internalFirebase]);
45
45
  const internalFirestore = useMemo(() => {
46
46
  if (firestoreEnabled) {
47
47
  if (emulators?.firestore?.host && emulators?.firestore?.port) {
48
- connectFirestoreEmulator(firestore(), emulators.firestore.host, emulators.firestore.port);
48
+ connectFirestoreEmulator(getFirestore(internalFirebase), emulators.firestore.host, emulators.firestore.port);
49
49
  }
50
- const localFirestore = firestore();
50
+ const localFirestore = getFirestore(internalFirebase);
51
51
  if (firestoreSettings) {
52
52
  localFirestore.settings(firestoreSettings);
53
53
  }
54
54
  return localFirestore;
55
55
  }
56
56
  return null;
57
- }, [emulators?.firestore, firestoreEnabled, firestoreSettings]);
57
+ }, [emulators?.firestore, firestoreEnabled, internalFirebase, firestoreSettings]);
58
58
  const internalAuth = useMemo(() => {
59
59
  if (authEnabled) {
60
- const localAuth = auth();
60
+ const localAuth = getAuth(internalFirebase);
61
61
  if (emulators?.auth?.host) {
62
62
  connectAuthEmulator(localAuth, emulators?.auth?.host, {
63
63
  disableWarnings: true
@@ -66,16 +66,16 @@ export const FirebaseContextProvider = ({ emulators, children, authEnabled = tru
66
66
  return localAuth;
67
67
  }
68
68
  return null;
69
- }, [emulators?.auth, authEnabled]);
69
+ }, [emulators?.auth, authEnabled, internalFirebase]);
70
70
  const internalAnalytics = useMemo(() => {
71
71
  if (analyticsEnabled) {
72
- return analytics();
72
+ return getAnalytics(internalFirebase);
73
73
  }
74
74
  return null;
75
- }, [analyticsEnabled]);
75
+ }, [analyticsEnabled, internalFirebase]);
76
76
  const internalRemoteConfig = useMemo(() => {
77
77
  if (remoteConfigEnabled) {
78
- const localRemoteConfig = remoteConfig();
78
+ const localRemoteConfig = getRemoteConfig(internalFirebase);
79
79
  if (remoteConfigSettings) {
80
80
  localRemoteConfig.settings.fetchTimeMillis = remoteConfigSettings.fetchTimeMillis;
81
81
  localRemoteConfig.settings.minimumFetchIntervalMillis = remoteConfigSettings.minimumFetchIntervalMillis;
@@ -84,7 +84,7 @@ export const FirebaseContextProvider = ({ emulators, children, authEnabled = tru
84
84
  return localRemoteConfig;
85
85
  }
86
86
  return null;
87
- }, [remoteConfigEnabled, remoteConfigSettings, remoteConfigDefaults]);
87
+ }, [remoteConfigEnabled, remoteConfigSettings, remoteConfigDefaults, internalFirebase]);
88
88
  const contextValue = useMemo(() => ({
89
89
  firebase: internalFirebase,
90
90
  auth: internalAuth,
@@ -1,14 +1,15 @@
1
1
  import React, { PropsWithChildren, useEffect, useMemo } from "react";
2
2
  import { FirebaseContext, FirebaseContextValue } from "./FirebaseContext";
3
- import auth, { connectAuthEmulator } from "@react-native-firebase/auth";
4
- import analytics, {
3
+ import { connectAuthEmulator, getAuth } from "@react-native-firebase/auth";
4
+ import {
5
5
  FirebaseAnalyticsTypes,
6
6
  setAnalyticsCollectionEnabled,
7
- setConsent
7
+ setConsent,
8
+ getAnalytics
8
9
  } from "@react-native-firebase/analytics";
9
- import remoteConfig, { FirebaseRemoteConfigTypes } from "@react-native-firebase/remote-config";
10
- import firestore, { connectFirestoreEmulator } from "@react-native-firebase/firestore";
11
- import firebase, { ReactNativeFirebase } from "@react-native-firebase/app";
10
+ import { FirebaseRemoteConfigTypes, getRemoteConfig } from "@react-native-firebase/remote-config";
11
+ import { connectFirestoreEmulator, getFirestore } from "@react-native-firebase/firestore";
12
+ import { ReactNativeFirebase, getApp } from "@react-native-firebase/app";
12
13
 
13
14
  /**
14
15
  * @inline
@@ -164,10 +165,10 @@ export const FirebaseContextProvider: React.FC<FirebaseContextProviderProps> = (
164
165
  remoteConfigDefaults = {},
165
166
  firestoreSettings
166
167
  }) => {
167
- const internalFirebase = useMemo(() => firebase, []);
168
+ const internalFirebase = useMemo(() => getApp(), []);
168
169
 
169
170
  useEffect(() => {
170
- setConsent(analytics(), {
171
+ setConsent(getAnalytics(internalFirebase), {
171
172
  ad_personalization: false,
172
173
  ad_storage: false,
173
174
  ad_user_data: false,
@@ -177,15 +178,19 @@ export const FirebaseContextProvider: React.FC<FirebaseContextProviderProps> = (
177
178
  security_storage: false,
178
179
  ...consentSettings
179
180
  });
180
- }, [consentSettings]);
181
+ }, [consentSettings, internalFirebase]);
181
182
 
182
183
  const internalFirestore = useMemo(() => {
183
184
  if (firestoreEnabled) {
184
185
  if (emulators?.firestore?.host && emulators?.firestore?.port) {
185
- connectFirestoreEmulator(firestore(), emulators.firestore.host, emulators.firestore.port);
186
+ connectFirestoreEmulator(
187
+ getFirestore(internalFirebase),
188
+ emulators.firestore.host,
189
+ emulators.firestore.port
190
+ );
186
191
  }
187
192
 
188
- const localFirestore = firestore();
193
+ const localFirestore = getFirestore(internalFirebase);
189
194
  if (firestoreSettings) {
190
195
  localFirestore.settings(firestoreSettings);
191
196
  }
@@ -193,11 +198,11 @@ export const FirebaseContextProvider: React.FC<FirebaseContextProviderProps> = (
193
198
  }
194
199
 
195
200
  return null;
196
- }, [emulators?.firestore, firestoreEnabled, firestoreSettings]);
201
+ }, [emulators?.firestore, firestoreEnabled, internalFirebase, firestoreSettings]);
197
202
 
198
203
  const internalAuth = useMemo(() => {
199
204
  if (authEnabled) {
200
- const localAuth = auth();
205
+ const localAuth = getAuth(internalFirebase);
201
206
  if (emulators?.auth?.host) {
202
207
  connectAuthEmulator(localAuth, emulators?.auth?.host, {
203
208
  disableWarnings: true
@@ -206,18 +211,18 @@ export const FirebaseContextProvider: React.FC<FirebaseContextProviderProps> = (
206
211
  return localAuth;
207
212
  }
208
213
  return null;
209
- }, [emulators?.auth, authEnabled]);
214
+ }, [emulators?.auth, authEnabled, internalFirebase]);
210
215
 
211
216
  const internalAnalytics = useMemo(() => {
212
217
  if (analyticsEnabled) {
213
- return analytics();
218
+ return getAnalytics(internalFirebase);
214
219
  }
215
220
  return null;
216
- }, [analyticsEnabled]);
221
+ }, [analyticsEnabled, internalFirebase]);
217
222
 
218
223
  const internalRemoteConfig = useMemo(() => {
219
224
  if (remoteConfigEnabled) {
220
- const localRemoteConfig = remoteConfig();
225
+ const localRemoteConfig = getRemoteConfig(internalFirebase);
221
226
  if (remoteConfigSettings) {
222
227
  localRemoteConfig.settings.fetchTimeMillis = remoteConfigSettings.fetchTimeMillis;
223
228
  localRemoteConfig.settings.minimumFetchIntervalMillis = remoteConfigSettings.minimumFetchIntervalMillis;
@@ -226,7 +231,7 @@ export const FirebaseContextProvider: React.FC<FirebaseContextProviderProps> = (
226
231
  return localRemoteConfig;
227
232
  }
228
233
  return null;
229
- }, [remoteConfigEnabled, remoteConfigSettings, remoteConfigDefaults]);
234
+ }, [remoteConfigEnabled, remoteConfigSettings, remoteConfigDefaults, internalFirebase]);
230
235
 
231
236
  const contextValue = useMemo(
232
237
  () => ({