@umituz/react-native-firebase 1.13.83 → 1.13.86
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 +5 -4
- package/src/index.ts +6 -0
- package/src/init/createFirebaseInitModule.ts +81 -0
- package/src/init/index.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-firebase",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.86",
|
|
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",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@tanstack/react-query": "^5.66.7",
|
|
52
52
|
"@tanstack/react-query-persist-client": "^5.66.7",
|
|
53
53
|
"@types/jest": "^30.0.0",
|
|
54
|
+
"@types/node": "^20.11.0",
|
|
54
55
|
"@types/react": "~19.1.10",
|
|
55
56
|
"@typescript-eslint/eslint-plugin": "^8.52.0",
|
|
56
57
|
"@typescript-eslint/parser": "^8.52.0",
|
|
@@ -80,12 +81,12 @@
|
|
|
80
81
|
"firebase": "^12.6.0",
|
|
81
82
|
"firebase-admin": "^13.6.0",
|
|
82
83
|
"i18next": "^25.7.3",
|
|
83
|
-
"react-i18next": "^16.5.1",
|
|
84
|
-
"react-native-safe-area-context": "^5.6.2",
|
|
85
|
-
"react-native-svg": "^15.15.1",
|
|
86
84
|
"react": "19.1.0",
|
|
85
|
+
"react-i18next": "^16.5.1",
|
|
87
86
|
"react-native": "0.81.5",
|
|
88
87
|
"react-native-gesture-handler": "^2.30.0",
|
|
88
|
+
"react-native-safe-area-context": "^5.6.2",
|
|
89
|
+
"react-native-svg": "^15.15.1",
|
|
89
90
|
"rn-emoji-keyboard": "^1.7.0",
|
|
90
91
|
"typescript": "~5.9.2",
|
|
91
92
|
"zustand": "^5.0.3"
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Init Module Factory
|
|
3
|
+
* Creates a ready-to-use InitModule for app initialization
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
initializeAllFirebaseServices,
|
|
8
|
+
initializeFirebaseAuth,
|
|
9
|
+
} from '../infrastructure/config/FirebaseClient';
|
|
10
|
+
|
|
11
|
+
declare const __DEV__: boolean;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* InitModule interface (from @umituz/react-native-design-system)
|
|
15
|
+
*/
|
|
16
|
+
export interface InitModule {
|
|
17
|
+
name: string;
|
|
18
|
+
init: () => Promise<boolean>;
|
|
19
|
+
critical?: boolean;
|
|
20
|
+
dependsOn?: string[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FirebaseInitModuleConfig {
|
|
24
|
+
/**
|
|
25
|
+
* Custom auth initializer function
|
|
26
|
+
* @default () => initializeFirebaseAuth()
|
|
27
|
+
*/
|
|
28
|
+
authInitializer?: () => Promise<void>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Whether this module is critical for app startup
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
critical?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Creates a Firebase initialization module for use with createAppInitializer
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { createAppInitializer } from "@umituz/react-native-design-system";
|
|
43
|
+
* import { createFirebaseInitModule } from "@umituz/react-native-firebase";
|
|
44
|
+
*
|
|
45
|
+
* export const initializeApp = createAppInitializer({
|
|
46
|
+
* modules: [
|
|
47
|
+
* createFirebaseInitModule(),
|
|
48
|
+
* // ... other modules
|
|
49
|
+
* ],
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export function createFirebaseInitModule(
|
|
54
|
+
config: FirebaseInitModuleConfig = {}
|
|
55
|
+
): InitModule {
|
|
56
|
+
const { authInitializer, critical = true } = config;
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
name: 'firebase',
|
|
60
|
+
critical,
|
|
61
|
+
init: async () => {
|
|
62
|
+
try {
|
|
63
|
+
await initializeAllFirebaseServices(undefined, {
|
|
64
|
+
authInitializer: authInitializer ?? (() => initializeFirebaseAuth()),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
68
|
+
console.log('[createFirebaseInitModule] Firebase initialized');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return true;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
74
|
+
console.error('[createFirebaseInitModule] Error:', error);
|
|
75
|
+
}
|
|
76
|
+
// Return false to indicate failure, let the app initializer handle it
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|