I am using react native firebase npm module https://rnfirebase.io/auth/usage with expo so if followed docs and created firebasse android and ios apps and downloaded the google.services and GoogleInfo.plist files and configured with the product.
As mention in the docs i am adding listner that listines the auth state changes as provided in docs
My entrypoing file looks like below
const [initializing, setInitializing] = useState(true);
function onAuthStateChanged(user: any) {
if (initializing) setInitializing(false);
}
useEffect(() => {
const subscriber = auth().onAuthStateChanged(onAuthStateChanged);
return subscriber; // unsubscribe on asunmount
}, []);
if (initializing) return null;
I am getting error Error: No Firebase App ‘[DEFAULT]’ has been created – call firebase.initializeApp() from auth().onAuthStateChanged(onAuthStateChanged) auth() method.
if i remove this subscription works runs just fine with expo development app.
As mentino in docs with expo we dont need to call initiliseApp of firebase
Whats wrong here?
I want to subscribe a listner that listnes the auth state change