@umituz/react-native-firebase 2.4.87 → 2.4.89
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": "2.4.
|
|
3
|
+
"version": "2.4.89",
|
|
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",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"lint": "eslint src --ext .ts,.tsx --max-warnings 0",
|
|
12
12
|
"version:patch": "npm version patch -m 'chore: release v%s'",
|
|
13
13
|
"version:minor": "npm version minor -m 'chore: release v%s'",
|
|
14
|
-
"version:major": "npm version major -m 'chore: release v%s'"
|
|
14
|
+
"version:major": "npm version major -m 'chore: release v%s'",
|
|
15
|
+
"setup:skill": "node -e \"const fs = require('fs'); const path = require('path'); const skillDir = path.join(process.env.HOME, '.claude', 'skills', 'setup-react-native-firebase'); fs.mkdirSync(skillDir, {recursive: true}); fs.copyFileSync(path.join(__dirname, 'skills/SKILL.md'), path.join(skillDir, 'SKILL.md')); console.log('✅ Firebase setup skill installed to Claude Code!');\""
|
|
15
16
|
},
|
|
16
17
|
"keywords": [
|
|
17
18
|
"react-native",
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Sets up or updates the @umituz/react-native-firebase package in a React Native app.
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Firebase Infrastructure Setup Workflow
|
|
6
|
-
|
|
7
|
-
This workflow provides automated setup for `@umituz/react-native-firebase` integration.
|
|
8
|
-
|
|
9
|
-
## Quick Start
|
|
10
|
-
|
|
11
|
-
Just invoke this workflow when you want to:
|
|
12
|
-
- Install @umituz/react-native-firebase in a new project
|
|
13
|
-
- Update existing installation to latest version
|
|
14
|
-
- Configure Firebase credentials and initialization
|
|
15
|
-
- Set up optimal cost-saving configurations
|
|
16
|
-
|
|
17
|
-
## Step 1: Check and Update `package.json`
|
|
18
|
-
|
|
19
|
-
Analyze the project's `package.json`:
|
|
20
|
-
- Check if `@umituz/react-native-firebase` exists in dependencies
|
|
21
|
-
- Check version (current: 2.4.86)
|
|
22
|
-
- If missing: Run `npm install @umituz/react-native-firebase`
|
|
23
|
-
- If outdated: Run `npm install @umituz/react-native-firebase@latest`
|
|
24
|
-
|
|
25
|
-
## Step 2: Install Peer Dependencies
|
|
26
|
-
|
|
27
|
-
Install required peer dependencies:
|
|
28
|
-
|
|
29
|
-
### Core Dependencies
|
|
30
|
-
```bash
|
|
31
|
-
# Firebase SDK
|
|
32
|
-
npm install firebase
|
|
33
|
-
|
|
34
|
-
# State Management
|
|
35
|
-
npm install @umituz/react-native-design-system
|
|
36
|
-
|
|
37
|
-
# Query Library
|
|
38
|
-
npm install @tanstack/react-query
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### React Navigation (if using)
|
|
42
|
-
```bash
|
|
43
|
-
npm install @gorhom/portal
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Authentication Dependencies (if using social auth)
|
|
47
|
-
```bash
|
|
48
|
-
# For Expo projects
|
|
49
|
-
npx expo install expo-apple-authentication expo-auth-session expo-crypto expo-web-browser
|
|
50
|
-
|
|
51
|
-
# For bare React Native
|
|
52
|
-
npm install @react-native-firebase/app @react-native-firebase/auth
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Step 3: Check Environment Variables
|
|
56
|
-
|
|
57
|
-
Verify Firebase credentials are configured. Check for these environment variables:
|
|
58
|
-
|
|
59
|
-
**Required:**
|
|
60
|
-
- `EXPO_PUBLIC_FIREBASE_API_KEY`
|
|
61
|
-
- `EXPO_PUBLIC_FIREBASE_AUTH_DOMAIN`
|
|
62
|
-
- `EXPO_PUBLIC_FIREBASE_PROJECT_ID`
|
|
63
|
-
|
|
64
|
-
**Optional:**
|
|
65
|
-
- `EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET`
|
|
66
|
-
- `EXPO_PUBLIC_FIREBASE_MESSAGING_SENDER_ID`
|
|
67
|
-
- `EXPO_PUBLIC_FIREBASE_APP_ID`
|
|
68
|
-
|
|
69
|
-
Check if `.env` or `.env.example` exists. If not, create `.env.example`:
|
|
70
|
-
```env
|
|
71
|
-
# Firebase Configuration
|
|
72
|
-
EXPO_PUBLIC_FIREBASE_API_KEY=your_api_key_here
|
|
73
|
-
EXPO_PUBLIC_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
|
|
74
|
-
EXPO_PUBLIC_FIREBASE_PROJECT_ID=your-project-id
|
|
75
|
-
EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
|
|
76
|
-
EXPO_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
|
|
77
|
-
EXPO_PUBLIC_FIREBASE_APP_ID=your_app_id
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Step 4: Setup Initialization Logic
|
|
81
|
-
|
|
82
|
-
Locate the main entry point (usually `App.tsx`, `index.js`, `app/_layout.tsx` for Expo Router).
|
|
83
|
-
|
|
84
|
-
Check if Firebase is initialized. If not, add initialization:
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
import { autoInitializeFirebase } from '@umituz/react-native-firebase';
|
|
88
|
-
|
|
89
|
-
// Call initialization early in app lifecycle
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
autoInitializeFirebase();
|
|
92
|
-
}, []);
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
For Expo Router (app/_layout.tsx):
|
|
96
|
-
```typescript
|
|
97
|
-
import { autoInitializeFirebase } from '@umituz/react-native-firebase';
|
|
98
|
-
|
|
99
|
-
export default function RootLayout() {
|
|
100
|
-
// Initialize Firebase when app starts
|
|
101
|
-
autoInitializeFirebase();
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<Stack>
|
|
105
|
-
<Stack.Screen name="(tabs)" options={{ headerShown: false }}>
|
|
106
|
-
{/* your screens */}
|
|
107
|
-
</Stack.Screen>
|
|
108
|
-
</Stack>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Step 5: Native Setup (Bare React Native Only)
|
|
114
|
-
|
|
115
|
-
If the project has an `ios/` folder (bare React Native):
|
|
116
|
-
```bash
|
|
117
|
-
cd ios && pod install
|
|
118
|
-
cd ..
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
For Android, no additional setup needed beyond Step 4.
|
|
122
|
-
|
|
123
|
-
## Step 6: Verify Setup
|
|
124
|
-
|
|
125
|
-
Run the app and verify:
|
|
126
|
-
- No Firebase initialization errors
|
|
127
|
-
- Firestore queries work
|
|
128
|
-
- Authentication works (if configured)
|
|
129
|
-
- Quota tracking is active (check __DEV__ logs)
|
|
130
|
-
|
|
131
|
-
## Step 7: Enable Cost Optimizations (Recommended)
|
|
132
|
-
|
|
133
|
-
For production apps, enable smart cost-saving features:
|
|
134
|
-
|
|
135
|
-
```typescript
|
|
136
|
-
import { useSmartFirestoreSnapshot } from '@umituz/react-native-firebase';
|
|
137
|
-
|
|
138
|
-
// Instead of useFirestoreSnapshot, use the smart version
|
|
139
|
-
const { data } = useSmartFirestoreSnapshot({
|
|
140
|
-
queryKey: ['my-data'],
|
|
141
|
-
subscribe: (onData) => onSnapshot(collection(db, 'data'), (snap) => {
|
|
142
|
-
onData(snap.docs.map(d => d.data()));
|
|
143
|
-
}),
|
|
144
|
-
backgroundStrategy: 'suspend', // Saves battery and data when app backgrounds
|
|
145
|
-
});
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Troubleshooting
|
|
149
|
-
|
|
150
|
-
**Issue:** "Firebase not initialized"
|
|
151
|
-
- **Solution:** Make sure `autoInitializeFirebase()` is called in app entry point
|
|
152
|
-
- **Solution:** Verify environment variables are set correctly
|
|
153
|
-
|
|
154
|
-
**Issue:** "Module not found: @umituz/react-native-design-system"
|
|
155
|
-
- **Solution:** Run `npm install @umituz/react-native-design-system`
|
|
156
|
-
|
|
157
|
-
**Issue:** "Expo router not found"
|
|
158
|
-
- **Solution:** This package works with any navigation, adjust import paths as needed
|
|
159
|
-
|
|
160
|
-
## Step 8: Summary
|
|
161
|
-
|
|
162
|
-
After setup, provide user with:
|
|
163
|
-
1. ✅ Packages installed/updated: [list versions]
|
|
164
|
-
2. ✅ Environment variables configured: [list keys]
|
|
165
|
-
3. ✅ Initialization added to: [file path]
|
|
166
|
-
4. ✅ Cost optimizations enabled: [smart snapshot, persistent cache, etc.]
|
|
167
|
-
5. ✅ Next steps: [initialize auth, setup Firestore, etc.]
|
|
168
|
-
|
|
169
|
-
## Additional Resources
|
|
170
|
-
|
|
171
|
-
- Documentation: See README.md for detailed API reference
|
|
172
|
-
- Examples: Check `/examples` folder (if exists)
|
|
173
|
-
- Support: Report issues on GitHub
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
**Last Updated:** 2025-03-18
|
|
177
|
-
**Package Version:** 2.4.86
|
|
178
|
-
**Platform:** React Native (Expo & Bare)
|