react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

Convert App to Firebase Modular SDK

Open rybaier opened this issue 1 year ago • 4 comments

  • 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

rybaier avatar Feb 10 '24 03:02 rybaier

i'm getting this problem with this code:

Uncaught TypeError: (0 , _auth.getReactNativePersistence) is not a function

Captura de tela 2024-02-19 152300

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 avatar Feb 19 '24 18:02 victorgaudio

@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 avatar Feb 19 '24 19:02 rybaier

@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 avatar Feb 19 '24 21:02 victorgaudio

@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

rybaier avatar Feb 19 '24 23:02 rybaier