android – Does the Javascript thread get inactive before UI thread in React Native?


We have implemented a task timer app in React Native.

Users can add tasks with a time. When the user starts the time it will start a countdown and once it finishes it will sound an alarm and move on to the next task.

The issue comes when the user goes background while the timer is running.

The alarm sound is not heard sometimes in the background. The timer has gone to minus values skipping the condition to move on to the next task which is

useEffect(() => {
    if (elapsedTime === totalTime) {
        runTheAlarm();
        onCountFinish();
    }
}, [elapsedTime, totalTime]); 

My thought was the JavaScript thread gets inactive before the UI thread. Can this be resolved if I create the timer on the Native side (Swift) and use it here?

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img