Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

121
Views
React Native - AppState with async function

In React Native, we use AppState to check app is in active or background or something. What I want to do is when appState eventListener is catch that app is going background, execute some async function.

But when that moment, non-async function is executed and async function is not executed and back to foreGround(active), that async function is executed.

Maybe cause JavaScript Event Loop, that async function is buffered in a queue and executed in the foreground.

What could I do for executing instantly?

const listener = AppState.addEventListener('change', (state) => {
  let timeout;

  if (state === 'background') {
    asyncFunction();
  }
})
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!