withTiming callback is getting trigger on render instead of getting trigger when animation end #4199
Unanswered
AdarshJais
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I fetch the token on app start and if auth is not available I start the animation and at end of the animation I navigate the user to login. But if auth is present the animation should not run and the user should navigate inside the app instead of loginscreen. But what I can see here is that the callback of withTiming is getting triggered on render of the component(Due to this the user is always navigated to the login screen.) instead of getting ideally triggered only if startAnimation get invoked and further animation end.
//UI COMPONENT
A hack I've put is that I added an additional check above the callback function, that even though the callback gets triggered if the token is not present(user is not logged-in) then and only then trigger the go to login method.
But, this check fails if the internet is not active and to handle that I need to put in more addition checks.
This is a horrible workaround. I want the callback to get ideally triggered only and only if the startAnimation function is invoked and the animation end.
Beta Was this translation helpful? Give feedback.
All reactions