Home > Mobile >  Unable to import Firebase JS SDK with React Native Expo
Unable to import Firebase JS SDK with React Native Expo

Time:10-08

In my React Native app, I am trying to use the Firebase JS SDK with Expo as mentioned in enter image description here

edit: I am using getAuth() and the other methods in the following context:

React.useEffect(() => {

 if (response?.type === "success") {
  const { id_token } = response.params;

  const auth = getAuth();      
  const provider = new GoogleAuthProvider();
  const credential = provider.credential(id_token);
  signInWithCredential(auth, credential);
 }
}, [response]);

I am using Firebase 8.2.3.

CodePudding user response:

The import syntax you're using is for Firebase SDK version 9 and later. For version 8 and below, use:

import firebase from 'firebase/app';
import 'firebase/auth';
...

And then use the v8 syntax as shown here.

  • Related