Timers in React Native Introduction

Exploring the Timers in React Native

MahYar
The Startup
2 min readAug 2, 2020

--

React Native image

Timers are a crucial section of an application. React Native implements the browser Timers.

A JavaScript code block is normally accomplished synchronously. But there are some JavaScript native functions (Timers) that allow us to delay the execution.

There are four categories of React Native Timers:

  1. Delay
  2. Repeat
  3. Immediate
  4. Animation Schedule

Now, let’s dive into the different Timers regarding React Native and Mozilla official documentation.

DELAY

Calling the function or executing the code block after the stated delay.

Removing the delay, set by setTimeout().

timeoutID: The ID is returned by calling the setTimeout

REPEAT

Calling the function or executing the code block repeatedly, with a fixed time delay between each call.

Canceling the repeated action that was created by setInterval().

IMMEDIATE

Calling the function or execution as soon as possible.

Canceling the immediate actions that were set by setImmediate().

ANIMATION SCHEDULE

It is the standard way to perform animations.

Calling a function to update an animation before the next animation frame.

Canceling the function that was set by requestAnimationFrame().

Happy coding. 👩‍💻👨‍💻

Please let me know in the comments if I missed any part.

--

--

MahYar
The Startup

Software Engineer @Qvik. Doctoral Candidate in Software Engineering @LUT. I am fascinated by the cutting edge technologies.