@umituz/react-native-firebase 3.0.0 → 3.0.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-firebase",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
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",
|
|
@@ -1,52 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Firestore Configuration Client
|
|
3
3
|
*
|
|
4
|
-
* IMPORTANT:
|
|
5
|
-
*
|
|
4
|
+
* IMPORTANT: This package does NOT import from firebase/firestore to avoid
|
|
5
|
+
* IndexedDB dependencies that break React Native bundling.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Instead, you should:
|
|
8
|
+
* 1. Install firebase SDK in your app: npm install firebase
|
|
9
|
+
* 2. Import and use getFirestore() from 'firebase/firestore' directly
|
|
10
|
+
* 3. Use the utilities from this package for repositories and helpers
|
|
8
11
|
*/
|
|
9
12
|
|
|
10
13
|
import { FirebaseInitializationError } from "../../../../shared/domain/errors/FirebaseError";
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
// Firestore type from firebase/firestore SDK
|
|
16
|
+
// Import in your app: import type { Firestore } from 'firebase/firestore'
|
|
17
|
+
export type Firestore = unknown;
|
|
15
18
|
|
|
16
19
|
let firestoreInstance: Firestore | null = null;
|
|
17
20
|
let initializationError: Error | null = null;
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Initialize Firestore
|
|
21
|
-
*
|
|
24
|
+
*
|
|
25
|
+
* DEPRECATED: This function is deprecated and will be removed in future versions.
|
|
26
|
+
*
|
|
27
|
+
* Instead, initialize Firestore directly in your app:
|
|
28
|
+
* ```typescript
|
|
22
29
|
* import { initializeFirestore } from 'firebase/firestore';
|
|
23
30
|
* import { getReactNativePersistence } from 'firebase/firestore/react-native';
|
|
31
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
32
|
+
*
|
|
33
|
+
* const firestore = initializeFirestore(firebaseApp, {
|
|
34
|
+
* localCache: getReactNativePersistence(AsyncStorage)
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
24
37
|
*/
|
|
25
38
|
export async function initializeFirestore(
|
|
26
39
|
firebaseApp: unknown // FirebaseApp from firebase/app
|
|
27
40
|
): Promise<Firestore> {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// In a real app, you would do:
|
|
34
|
-
// const { getFirestore, initializeFirestore } = await import('firebase/firestore');
|
|
35
|
-
// const { getReactNativePersistence } = await import('firebase/firestore/react-native');
|
|
36
|
-
// const persistence = getReactNativePersistence();
|
|
37
|
-
// firestoreInstance = initializeFirestore(firebaseApp, {
|
|
38
|
-
// localCache: persistence
|
|
39
|
-
// });
|
|
40
|
-
|
|
41
|
-
// For now, this is a placeholder that assumes firestore is initialized elsewhere
|
|
42
|
-
throw new FirebaseInitializationError(
|
|
43
|
-
"Firestore must be initialized in your app using firebase/firestore SDK. " +
|
|
44
|
-
"Use initializeFirestore() from 'firebase/firestore' with React Native persistence."
|
|
45
|
-
);
|
|
46
|
-
} catch (error) {
|
|
47
|
-
initializationError = error as Error;
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
41
|
+
throw new FirebaseInitializationError(
|
|
42
|
+
"Firestore initialization has moved. " +
|
|
43
|
+
"Please use initializeFirestore() from 'firebase/firestore' directly in your app. " +
|
|
44
|
+
"See package README for migration guide."
|
|
45
|
+
);
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
/**
|
|
@@ -29,8 +29,10 @@ export interface FirebaseAppOptions {
|
|
|
29
29
|
// Firestore Types
|
|
30
30
|
// =============================================================================
|
|
31
31
|
|
|
32
|
+
// IMPORTANT: Import Firestore from 'firebase/firestore' in your app
|
|
33
|
+
// Do NOT use this type - it's only for internal package compatibility
|
|
32
34
|
export interface Firestore {
|
|
33
|
-
|
|
35
|
+
readonly __brand: 'Firestore';
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export interface DocumentSnapshot<T = unknown> {
|