Skip to content

Commit

Permalink
Persisting authentication state
Browse files Browse the repository at this point in the history
  • Loading branch information
EuJinnLucaShow committed Aug 25, 2023
1 parent 1c417a2 commit 00e6c20
Show file tree
Hide file tree
Showing 11 changed files with 279 additions and 137 deletions.
18 changes: 12 additions & 6 deletions FirebaseConfig.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/database';
import 'firebase/compat/storage';
import { initializeApp } from 'firebase/app';
import { getFirestore } from 'firebase/firestore';
import { getStorage } from 'firebase/storage';
import { initializeAuth, getReactNativePersistence } from 'firebase/auth';
import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';

const firebaseConfig = {
apiKey: 'AIzaSyBe9QUzhoIEVFB69Rqt8mMbjUwRxjO9KKg',
Expand All @@ -12,6 +13,11 @@ const firebaseConfig = {
appId: '1:868623960717:web:e1dfe1b9f383dc100db0c4',
};

firebase.initializeApp(firebaseConfig);
const app = initializeApp(firebaseConfig);

export default firebase;
export const auth = initializeAuth(app, {
persistence: getReactNativePersistence(ReactNativeAsyncStorage),
});

export const db = getFirestore(app);
export const storage = getStorage(app);
168 changes: 103 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"web": "expo start --web"
},
"dependencies": {
"@react-native-async-storage/async-storage": "1.18.2",
"@react-native-async-storage/async-storage": "^1.18.2",
"@react-navigation/bottom-tabs": "^6.5.8",
"@react-navigation/native": "^6.1.7",
"@react-navigation/native-stack": "^6.9.13",
Expand All @@ -23,15 +23,17 @@
"expo-location": "~16.1.0",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"firebase": "^10.2.0",
"firebase": "^10.3.0",
"react": "18.2.0",
"react-native": "0.72.4",
"react-native-get-random-values": "^1.9.0",
"react-native-maps": "^1.7.1",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native-vector-icons": "^10.0.0",
"react-redux": "^8.1.2",
"redux-persist": "^6.0.0"
"redux-persist": "^6.0.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@babel/core": "^7.20.0"
Expand Down
Loading

0 comments on commit 00e6c20

Please sign in to comment.