You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement the logout function in my application without pushing the authentication screen back onto my navigation stack, instead I wish to replace the navigation stack with the authentication screen. ( I've been really careful to not push screens onto the stack without popping them off, in order to only keep a few items in the stack at any given time )
From the documentation Actions.reset(...)
Clears the routing stack and pushes the scene into the first index. No transition will occur.
Once calling Actions.reset I then try to clear my Redux state that's used in my Profile screen. However, even though I've reset the navigation stack the application crashes with undefined variable errors from the Profile (as a result of clearing the redux state on logout).
I've gone through the documentation thoroughly in order to try to find a way to determine when a navigation transition is completed, but I haven't found anything.
The way I found to do this was to use componentWillUnmount on my application's <Tabs /> component (Which is the root scene of the component when a user is authenticated) and dispatch from there in order to clear the state.
This seems to be working, but it also requires me to separate my code. Is there any way to do this in a more clean and localized manner? For example:
This is a question.
I'm trying to implement the logout function in my application without pushing the authentication screen back onto my navigation stack, instead I wish to replace the navigation stack with the authentication screen. ( I've been really careful to not push screens onto the stack without popping them off, in order to only keep a few items in the stack at any given time )
From the documentation
Actions.reset(...)
Once calling
Actions.reset
I then try to clear my Redux state that's used in my Profile screen. However, even though I've reset the navigation stack the application crashes with undefined variable errors from the Profile (as a result of clearing the redux state on logout).I've gone through the documentation thoroughly in order to try to find a way to determine when a navigation transition is completed, but I haven't found anything.
The way I found to do this was to use
componentWillUnmount
on my application's<Tabs />
component (Which is the root scene of the component when a user is authenticated) and dispatch from there in order to clear the state.This seems to be working, but it also requires me to separate my code. Is there any way to do this in a more clean and localized manner? For example:
Which would be called after all of the components in the stack have been unmounted.
The text was updated successfully, but these errors were encountered: