Search code examples
firebasereact-nativefirebase-authenticationreact-native-firebase

Getting Undefined from Signing out using rnfirebase :


When I try to signout from rnfirebase I get an undefined error, here's what my code looks like :

CompileSdk = 33 Android = 11 Latest version of rnfirebase

import auth from '@react-native-firebase/auth';

export default function App() {
const SignOut = () => {
  auth.signOut().then(() => console.log('User Signed Out')).catch(e => console.log(e.message));
}

return(
  <>
    <Button onPress={SignOut}>Sign Out</Button>
  </>
)
}

I tried Async Await but I got an unhandled Promise, I reinstalled it serveral of times but still doesn't work


Solution

  • Answer found :

    I forgot that the auth import is not an object, It's a function so the fix is :

    const SignOut = () => {
      auth().signOut().then(() => console.log('User Signed Out')).catch(e => console.log(e.message));
    }