-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logout #9
Comments
Hello, |
So I saw a stack overflow saying I should use redux, then came across a documentation saying redux is ok for state, but not Navigation state. I wrote a logout function as: That logs out user, but doesnt re-render app.js which houses user auth logic. I looked react navigation documentation, but to no avail. Maybe I missed something Some sources say you can use NavigationActions , as navigation is not available for use as That said I passed navigation as a prop and it was empty. Thats because navigation.navigate() is only available to navigate to pages within the stack. In our case, HomeScreen is in one stack and Login + Registration is in another stack. So we cannot move up from stack to stack. But I wonder if we put all of them in the same stack, then navigation.navigate() will work right and being a mobile app, the user wont be able to navigate to the page without a button provided by us ? ....hmmm this just came to me #rubberDuckTheory .. I will test and get back to you guys. PS. I am not using redux for this, but might keep it in to manage other all round state bits. If any one else gets a solution, do post #happyLockdownCoding Mo |
UPDATE: So I did 2 things and I think it works. It seems to now be logging out for me and loads the component as the Login and Registration components are now in the stack. By the time it calls that component firebase .signOut() has already run So in effect, you wont be logged in anymore Try and let me know Hope this helps @mrcflorian Thank you for this awesome repo. Will be good to hear your thoughts. |
Hi, how can I remove state and logout user from this project?
I tried:
const signOut = async () => {
try {
await firebase.auth().signOut();
navigation.navigate("Login");
} catch (e) {
console.log(e);
}
}
but state wasn't removed
The text was updated successfully, but these errors were encountered: