@umituz/react-native-firebase 1.13.31 → 1.13.33

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.31",
3
+ "version": "1.13.33",
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",
@@ -30,13 +30,13 @@
30
30
  "url": "https://github.com/umituz/react-native-firebase"
31
31
  },
32
32
  "peerDependencies": {
33
- "@umituz/react-native-sentry": "latest",
33
+ "@umituz/react-native-sentry": "*",
34
+ "@umituz/react-native-storage": "*",
34
35
  "expo-apple-authentication": ">=6.0.0",
35
36
  "expo-crypto": ">=13.0.0",
36
37
  "firebase": ">=10.0.0",
37
38
  "react": ">=18.2.0",
38
- "react-native": ">=0.74.0",
39
- "zustand": ">=5.0.0"
39
+ "react-native": ">=0.74.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@react-native-async-storage/async-storage": "^2.2.0",
@@ -44,14 +44,14 @@
44
44
  "@sentry/types": "^10.32.1",
45
45
  "@types/jest": "^30.0.0",
46
46
  "@types/react": "~19.1.10",
47
- "@umituz/react-native-sentry": "^1.4.2",
47
+ "@umituz/react-native-sentry": "*",
48
+ "@umituz/react-native-storage": "*",
48
49
  "expo-apple-authentication": "^8.0.8",
49
50
  "expo-crypto": "^15.0.8",
50
51
  "firebase": "^12.6.0",
51
52
  "react": "19.1.0",
52
53
  "react-native": "0.81.5",
53
- "typescript": "~5.9.2",
54
- "zustand": "^5.0.0"
54
+ "typescript": "~5.9.2"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"
@@ -8,6 +8,8 @@
8
8
  import {
9
9
  initializeAuth,
10
10
  getAuth,
11
+ // @ts-ignore: getReactNativePersistence exists in the React Native bundle but missing from type definitions
12
+ // See: https://github.com/firebase/firebase-js-sdk/issues/9316
11
13
  getReactNativePersistence,
12
14
  } from 'firebase/auth';
13
15
  import type { Auth } from 'firebase/auth';
@@ -7,7 +7,7 @@
7
7
  * This store provides minimal state for low-level Firebase operations.
8
8
  */
9
9
 
10
- import { create } from "zustand";
10
+ import { createStore } from "@umituz/react-native-storage";
11
11
  import { onAuthStateChanged, type User, type Auth } from "firebase/auth";
12
12
 
13
13
  declare const __DEV__: boolean;
@@ -24,51 +24,54 @@ interface AuthActions {
24
24
  cleanup: () => void;
25
25
  }
26
26
 
27
- type AuthStore = AuthState & AuthActions;
28
-
29
27
  let unsubscribe: (() => void) | null = null;
30
28
 
31
- export const useFirebaseAuthStore = create<AuthStore>((set, get) => ({
32
- user: null,
33
- loading: true,
34
- initialized: false,
35
- listenerSetup: false,
29
+ export const useFirebaseAuthStore = createStore<AuthState, AuthActions>({
30
+ name: "firebase-auth-store",
31
+ initialState: {
32
+ user: null,
33
+ loading: true,
34
+ initialized: false,
35
+ listenerSetup: false,
36
+ },
37
+ persist: false,
38
+ actions: (set, get) => ({
39
+ setupListener: (auth: Auth) => {
40
+ const state = get();
36
41
 
37
- setupListener: (auth: Auth) => {
38
- const state = get();
42
+ if (state.listenerSetup || unsubscribe) {
43
+ return;
44
+ }
39
45
 
40
- if (state.listenerSetup || unsubscribe) {
41
- return;
42
- }
46
+ set({ listenerSetup: true });
43
47
 
44
- set({ listenerSetup: true });
48
+ unsubscribe = onAuthStateChanged(auth, (currentUser: User | null) => {
49
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
50
+ // eslint-disable-next-line no-console
51
+ console.log(
52
+ "[FirebaseAuthStore] Auth state changed:",
53
+ currentUser?.uid || "null"
54
+ );
55
+ }
56
+ set({
57
+ user: currentUser,
58
+ loading: false,
59
+ initialized: true,
60
+ });
61
+ });
62
+ },
45
63
 
46
- unsubscribe = onAuthStateChanged(auth, (currentUser: User | null) => {
47
- if (typeof __DEV__ !== "undefined" && __DEV__) {
48
- // eslint-disable-next-line no-console
49
- console.log(
50
- "[FirebaseAuthStore] Auth state changed:",
51
- currentUser?.uid || "null"
52
- );
64
+ cleanup: () => {
65
+ if (unsubscribe) {
66
+ unsubscribe();
67
+ unsubscribe = null;
53
68
  }
54
69
  set({
55
- user: currentUser,
56
- loading: false,
57
- initialized: true,
70
+ user: null,
71
+ loading: true,
72
+ initialized: false,
73
+ listenerSetup: false,
58
74
  });
59
- });
60
- },
61
-
62
- cleanup: () => {
63
- if (unsubscribe) {
64
- unsubscribe();
65
- unsubscribe = null;
66
- }
67
- set({
68
- user: null,
69
- loading: true,
70
- initialized: false,
71
- listenerSetup: false,
72
- });
73
- },
74
- }));
75
+ },
76
+ }),
77
+ });