I'm using React-Navigation 5 and React Native Firebase libraries. I want onStateChange not to work after navigating from Splash Screen to another screen, but what could be the reason it still works on background?
Here is onStateChange function:
function onAuthStateChanged(user) {
setUser(user);
if (initialized) setinitialized(false);
}
Here is useEffect function:
useEffect(() => {
const subscriber = auth().onAuthStateChanged(onAuthStateChanged);
return subscriber; // unsubscribe on unmount
}, []);