Skip to content

Worklet compatible setTimeout and setInterval #3660

Answered by MatiPl01
elliotwaite asked this question in Q&A
Discussion options

You must be logged in to vote

Hey!

If you want API more similar to the one from JS and don't want to create the timeout with a hook, here is the implementation of mine I made some time ago. You can check it out:

I also implemented setAnimatedInterval which is similar to JS setInterval.
The implementation uses approach similar to what reanimated does while it executes withTiming and withDelay animations by using the requestAnimationFrame JS function.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@elliotwaite
Comment options

Comment options

You must be logged in to vote
1 reply
@elliotwaite
Comment options

Answer selected by elliotwaite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants