Convert App to Firebase Modular SDK
- Update firebase calls to use new Modular syntax
- Update imports, function calls, useEffect hooks
- Update react and expo packages
- Add AsyncStorage for ReactNativePersistence for firebase auth
i'm getting this problem with this code:
Uncaught TypeError: (0 , _auth.getReactNativePersistence) is not a function
it's solved by commenting this. but the persistence is turned off.
// Initialize Firebase const app = initializeApp(firebaseConfig); const auth = initializeAuth(app, { // persistence: getReactNativePersistence(ReactNativeAsyncStorage) }) const db = getFirestore(app);
to reproduce this error is just to do npm install and npm start.
i'm using vscode and powershell on windows 11 and chrome / edge browser to browse. tried to run it on ios and web too
@victorgaudio I can not reproduce your error from the code. Can you submit a screenshot of your firebase config page(please edit out your specific firebase details)? are you using an emulator or expoGO app on your phone to show the react-native app from the metro bundle?
@rybaier
i'm using the default firebase config that came with the code to test. its working with these configurations.
updating the status: on ios with expoGo it works fine.
when I run as Web, with "w" on npm start, this problem occours.
I'm searching for something to solve this here, running on web is important for me. But the code is running well on expoGo. Thanks (and congrats) for your collaboration.
ps. I've added a logout function on homescreen to facilitate the tests.
thx
@victorgaudio
ok that makes sense. as the react-native-persistence is specific to running as an expo App. You could swap the persistence specifications to local storage or browserSessionPersistence.
additionally I am continuing to work on this in a separate repo where I'm adding more options with delete, update, a logout function, and loading screen here's the link to the repo where I'm expanding on it for creating a complete app
https://github.com/rybaier/react-native-firebase