diff --git a/contexts/firebase.js b/contexts/firebase.js index bfd2449..fc8ff84 100644 --- a/contexts/firebase.js +++ b/contexts/firebase.js @@ -1,6 +1,8 @@ + import { initializeApp } from 'firebase/app'; -import { getAuth } from 'firebase/auth'; +import { initializeAuth, getReactNativePersistence } from 'firebase/auth'; +import AsyncStorage from '@react-native-async-storage/async-storage'; const firebaseConfig = { apiKey: process.env.EXPO_PUBLIC_FIREBASE_API_KEY, @@ -14,6 +16,8 @@ const firebaseConfig = { const app = initializeApp(firebaseConfig); -const auth = getAuth(app); +const auth = initializeAuth(app, { + persistence: getReactNativePersistence(AsyncStorage) +}); export { auth };